-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Is the functional interface for the constructor parameters like named parameters. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal String
Is the field to set a display string of the option argument(s) in a help text.Is theOptional
object of a string list to specify default value(s) for when the command option is not given in command line arguments.final String
Is the string field to set the description of the option which is used in a help text.final boolean
Is the flag which allow the option to take option arguments.final boolean
Is the flag which allow the option to take multiple option arguments.Is the vector for specifying the option name and the aliases.final String
Is the key to store option value(s) in the option map in a `Cmd` instance.final Validator
Is the functional interface to validate the option argument(s). -
Constructor Summary
ConstructorsConstructorDescriptionOptCfg
(OptCfg.Param... params) Is the constructor that takes the variadic parameters ofOptCfg.Param
which can be specified like named parameters.OptCfg
(String storeKey, List<String> names, boolean hasArg, boolean isArray, List<String> defaults, String desc, String argInHelp, Validator validator) Is the constructor that takes the all field values as parameters. -
Method Summary
-
Field Details
-
storeKey
Is the key to store option value(s) in the option map in a `Cmd` instance.If this key is not specified or empty, the first element of the `names` field is used instead.
-
names
Is the vector for specifying the option name and the aliases.The order of the `names` in this array are used in a help text.
-
hasArg
public final boolean hasArgIs the flag which allow the option to take option arguments. -
isArray
public final boolean isArrayIs the flag which allow the option to take multiple option arguments. -
defaults
-
desc
Is the string field to set the description of the option which is used in a help text. -
argInHelp
Is the field to set a display string of the option argument(s) in a help text.An example of the display is like:
-o, --option <value>
. -
validator
Is the functional interface to validate the option argument(s).If the option argument is invalid, this method throws a
OptionArgIsInvalid
exception.
-
-
Constructor Details
-
OptCfg
public OptCfg(String storeKey, List<String> names, boolean hasArg, boolean isArray, List<String> defaults, String desc, String argInHelp, Validator validator) Is the constructor that takes the all field values as parameters.If
storeKey
is empty, it is set to first element ofnames
. Ifnames
is empty or it's first element is empty, the first element is set to the value ofstoreKey
.If
type
is not null buthasArg
is false,hasArg
is set to true forcely. Also,type
is not null butconverter
is null,converter
is set to a converter which convert a string to a specified type value.- Parameters:
storeKey
- The store key.names
- The option name and aliases.hasArg
- True, if this option can take option arguments.isArray
- True, if this option can take one or multiple option arguments.defaults
- The default value(s).desc
- The description of the option.argInHelp
- The display of the option argument.validator
- The validator to validate the option argument.
-
OptCfg
Is the constructor that takes the variadic parameters ofOptCfg.Param
which can be specified like named parameters.If
storeKey
is empty, it is set to first element ofnames
. Ifnames
is empty or it's first element is empty, the first element is set to the value ofstoreKey
.If
type
is not null buthasArg
is false,hasArg
is set to true forcely. Also,type
is not null butconverter
is null,converter
is set to a converter which convert a string to a specified type value.- Parameters:
params
- The variadic parameters ofOptCfg.Param
.
-
-
Method Details
-
toString
Returns the content string of this instance. -
makeOptCfgsFor
Makes anOptCfg
array from the fields opt the option store with the annotationOpt
.About the process for
OptCfg
usingOpt
annotation, see the comment ofCmd.parseFor(java.lang.Object)
method.- Parameters:
optStore
- An option store object.- Returns:
- An
OptCfg
array.
-