Package picocli
Class CommandLine.Model.OptionSpec.Builder
java.lang.Object
picocli.CommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
picocli.CommandLine.Model.OptionSpec.Builder
- Enclosing class:
CommandLine.Model.OptionSpec
public static class CommandLine.Model.OptionSpec.Builder
extends CommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
Builder responsible for creating valid
OptionSpec
objects.- Since:
- 3.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
private
Builder
(CommandLine.Model.IAnnotatedElement member, CommandLine.IFactory factory) private
Builder
(CommandLine.Model.OptionSpec original) -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a validOptionSpec
instance.Returns the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter.fallbackValue
(String fallbackValue) Sets the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter, and returns this builder.boolean
help()
Deprecated.help
(boolean help) Sets whether this option disables validation of the other arguments, and returns this builder.String[]
names()
Returns one or more option names.Replaces the option names with the specified values.boolean
Returns whether a negative version for this boolean option is automatically added.negatable
(boolean negatable) Sets whether a negative version for this boolean option is automatically added, and returns this builder.int
order()
Returns the position in the options list in the usage help message at which this option should be shown.order
(int order) Sets the position in the options list in the usage help message at which this option should be shown, and returns this builder.protected CommandLine.Model.OptionSpec.Builder
self()
Returns this builder.boolean
Returns whether this option allows the user to request usage help.usageHelp
(boolean usageHelp) Sets whether this option allows the user to request usage help, and returns this builder.boolean
Returns whether this option allows the user to request version information.versionHelp
(boolean versionHelp) Sets whether this option allows the user to request version information, and returns this builder.Methods inherited from class picocli.CommandLine.Model.ArgSpec.Builder
arity, arity, arity, auxiliaryTypes, auxiliaryTypes, completionCandidates, completionCandidates, converters, converters, defaultValue, defaultValue, description, description, descriptionKey, descriptionKey, echo, echo, getter, getter, hasInitialValue, hasInitialValue, hidden, hidden, hideParamSyntax, hideParamSyntax, inherited, inherited, initialValue, initialValue, interactive, interactive, mapFallbackValue, mapFallbackValue, parameterConsumer, parameterConsumer, paramLabel, paramLabel, preprocessor, preprocessor, prompt, prompt, required, required, root, root, scope, scope, scopeType, scopeType, setter, setter, showDefaultValue, showDefaultValue, splitRegex, splitRegex, splitRegexSynopsisLabel, splitRegexSynopsisLabel, toString, type, type, typeInfo, typeInfo, userObject, userObject, withToString
-
Field Details
-
names
-
help
private boolean help -
usageHelp
private boolean usageHelp -
versionHelp
private boolean versionHelp -
negatable
private boolean negatable -
fallbackValue
-
originalFallbackValue
-
order
private int order
-
-
Constructor Details
-
Builder
-
Builder
-
Builder
-
-
Method Details
-
build
Returns a validOptionSpec
instance.- Specified by:
build
in classCommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
-
self
Returns this builder.- Specified by:
self
in classCommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
-
names
Returns one or more option names. At least one option name is required.- See Also:
-
help
Deprecated.UseusageHelp()
andversionHelp()
instead.Returns whether this option disables validation of the other arguments.- See Also:
-
usageHelp
public boolean usageHelp()Returns whether this option allows the user to request usage help.- See Also:
-
versionHelp
public boolean versionHelp()Returns whether this option allows the user to request version information.- See Also:
-
negatable
public boolean negatable()Returns whether a negative version for this boolean option is automatically added. The form of the negative name is determined by theCommandLine.INegatableOptionTransformer
.- Since:
- 4.0
- See Also:
-
fallbackValue
Returns the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter.- Since:
- 4.0
- See Also:
-
order
public int order()Returns the position in the options list in the usage help message at which this option should be shown. Options with a lower number are shown before options with a higher number. This attribute is only honored ifCommandLine.Model.UsageMessageSpec.sortOptions()
isfalse
for this command.- Since:
- 3.9
- See Also:
-
names
Replaces the option names with the specified values. At least one option name is required, and returns this builder.- Returns:
- this builder instance to provide a fluent interface
-
help
Sets whether this option disables validation of the other arguments, and returns this builder. -
usageHelp
Sets whether this option allows the user to request usage help, and returns this builder. -
versionHelp
Sets whether this option allows the user to request version information, and returns this builder. -
negatable
Sets whether a negative version for this boolean option is automatically added, and returns this builder.- Since:
- 4.0
-
fallbackValue
Sets the fallback value for this option: the value that is assigned for options with an optional parameter if the option was specified on the command line without parameter, and returns this builder.- Since:
- 4.0
- See Also:
-
order
Sets the position in the options list in the usage help message at which this option should be shown, and returns this builder.- Since:
- 3.9
-
usageHelp()
andversionHelp()
instead.