Package org.apache.commons.cli
Class CommandLine.Builder
- java.lang.Object
-
- org.apache.commons.cli.CommandLine.Builder
-
- All Implemented Interfaces:
java.util.function.Supplier<CommandLine>
- Enclosing class:
- CommandLine
public static final class CommandLine.Builder extends java.lang.Object implements java.util.function.Supplier<CommandLine>
A nested builder class to createCommandLineinstance using descriptive methods.- Since:
- 1.4
-
-
Constructor Summary
Constructors Constructor Description Builder()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CommandLine.BuilderaddArg(java.lang.String arg)Adds left-over unrecognized option/argument.CommandLine.BuilderaddOption(Option option)Adds an option to the command line.CommandLinebuild()Deprecated.Useget().CommandLineget()Creates a new instance.CommandLine.BuildersetDeprecatedHandler(java.util.function.Consumer<Option> deprecatedHandler)Sets the deprecated option handler.
-
-
-
Constructor Detail
-
Builder
@Deprecated public Builder()
Deprecated.Constructs a new instance.
-
-
Method Detail
-
addArg
public CommandLine.Builder addArg(java.lang.String arg)
Adds left-over unrecognized option/argument.- Parameters:
arg- the unrecognized option/argument.- Returns:
- this Builder instance for method chaining.
-
addOption
public CommandLine.Builder addOption(Option option)
Adds an option to the command line. The values of the option are stored.- Parameters:
option- the processed option.- Returns:
- this Builder instance for method chaining.
-
build
@Deprecated public CommandLine build()
Deprecated.Useget().Creates a new instance.- Returns:
- a new instance.
-
get
public CommandLine get()
Creates a new instance.- Specified by:
getin interfacejava.util.function.Supplier<CommandLine>- Returns:
- a new instance.
- Since:
- 1.10.0
-
setDeprecatedHandler
public CommandLine.Builder setDeprecatedHandler(java.util.function.Consumer<Option> deprecatedHandler)
Sets the deprecated option handler.- Parameters:
deprecatedHandler- the deprecated option handler.- Returns:
thisinstance.- Since:
- 1.7.0
-
-