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 validOptionSpecobjects.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringfallbackValueprivate booleanhelpprivate java.lang.String[]namesprivate booleannegatableprivate intorderprivate booleanusageHelpprivate booleanversionHelp
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(java.lang.String[] names)privateBuilder(CommandLine.Model.IAnnotatedElement member, CommandLine.IFactory factory)privateBuilder(CommandLine.Model.OptionSpec original)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CommandLine.Model.OptionSpecbuild()Returns a validOptionSpecinstance.java.lang.StringfallbackValue()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.CommandLine.Model.OptionSpec.BuilderfallbackValue(java.lang.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.booleanhelp()Deprecated.UseusageHelp()andversionHelp()instead.CommandLine.Model.OptionSpec.Builderhelp(boolean help)Sets whether this option disables validation of the other arguments, and returns this builder.java.lang.String[]names()Returns one or more option names.CommandLine.Model.OptionSpec.Buildernames(java.lang.String... names)Replaces the option names with the specified values.booleannegatable()Returns whether a negative version for this boolean option is automatically added.CommandLine.Model.OptionSpec.Buildernegatable(boolean negatable)Sets whether a negative version for this boolean option is automatically added, and returns this builder.intorder()Returns the position in the options list in the usage help message at which this option should be shown.CommandLine.Model.OptionSpec.Builderorder(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.Builderself()Returns this builder.booleanusageHelp()Returns whether this option allows the user to request usage help.CommandLine.Model.OptionSpec.BuilderusageHelp(boolean usageHelp)Sets whether this option allows the user to request usage help, and returns this builder.booleanversionHelp()Returns whether this option allows the user to request version information.CommandLine.Model.OptionSpec.BuilderversionHelp(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
-
-
-
-
Constructor Detail
-
Builder
private Builder(java.lang.String[] names)
-
Builder
private Builder(CommandLine.Model.OptionSpec original)
-
Builder
private Builder(CommandLine.Model.IAnnotatedElement member, CommandLine.IFactory factory)
-
-
Method Detail
-
build
public CommandLine.Model.OptionSpec build()
Returns a validOptionSpecinstance.- Specified by:
buildin classCommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
-
self
protected CommandLine.Model.OptionSpec.Builder self()
Returns this builder.- Specified by:
selfin classCommandLine.Model.ArgSpec.Builder<CommandLine.Model.OptionSpec.Builder>
-
names
public java.lang.String[] names()
Returns one or more option names. At least one option name is required.- See Also:
CommandLine.Option.names()
-
help
@Deprecated public boolean help()
Deprecated.UseusageHelp()andversionHelp()instead.Returns whether this option disables validation of the other arguments.- See Also:
CommandLine.Option.help()
-
usageHelp
public boolean usageHelp()
Returns whether this option allows the user to request usage help.- See Also:
CommandLine.Option.usageHelp()
-
versionHelp
public boolean versionHelp()
Returns whether this option allows the user to request version information.- See Also:
CommandLine.Option.versionHelp()
-
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:
CommandLine.Option.negatable()
-
fallbackValue
public java.lang.String 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:
CommandLine.Option.fallbackValue()
-
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()isfalsefor this command.- Since:
- 3.9
- See Also:
CommandLine.Option.order()
-
names
public CommandLine.Model.OptionSpec.Builder names(java.lang.String... 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
public CommandLine.Model.OptionSpec.Builder help(boolean help)
Sets whether this option disables validation of the other arguments, and returns this builder.
-
usageHelp
public CommandLine.Model.OptionSpec.Builder usageHelp(boolean usageHelp)
Sets whether this option allows the user to request usage help, and returns this builder.
-
versionHelp
public CommandLine.Model.OptionSpec.Builder versionHelp(boolean versionHelp)
Sets whether this option allows the user to request version information, and returns this builder.
-
negatable
public CommandLine.Model.OptionSpec.Builder negatable(boolean negatable)
Sets whether a negative version for this boolean option is automatically added, and returns this builder.- Since:
- 4.0
-
fallbackValue
public CommandLine.Model.OptionSpec.Builder fallbackValue(java.lang.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.- Since:
- 4.0
- See Also:
CommandLine.Option.fallbackValue()
-
order
public CommandLine.Model.OptionSpec.Builder 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.- Since:
- 3.9
-
-