Package org.apache.commons.cli
Class CommandLine.Builder
java.lang.Object
org.apache.commons.cli.CommandLine.Builder
- Enclosing class:
CommandLine
A nested builder class to create
CommandLine
instance using descriptive methods.- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe unrecognized options/argumentsPrints an Option toSystem.out
.Deprecated Option handler.The processed options -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds left-over unrecognized option/argument.Adds an option to the command line.build()
Creates the new instance.setDeprecatedHandler
(Consumer<Option> deprecatedHandler) Sets the deprecated option handler.
-
Field Details
-
DEPRECATED_HANDLER
Prints an Option toSystem.out
. -
args
The unrecognized options/arguments -
options
The processed options -
deprecatedHandler
Deprecated Option handler.
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addArg
Adds left-over unrecognized option/argument.- Parameters:
arg
- the unrecognized option/argument.- Returns:
- this Builder instance for method chaining.
-
addOption
Adds an option to the command line. The values of the option are stored.- Parameters:
opt
- the processed option.- Returns:
- this Builder instance for method chaining.
-
build
Creates the new instance.- Returns:
- the new instance.
-
setDeprecatedHandler
Sets the deprecated option handler.- Parameters:
deprecatedHandler
- the deprecated option handler.- Returns:
this
instance.- Since:
- 1.7.0
-