Package com.beust.jcommander
Annotation Interface Parameter
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionint
If specified, the category name will be used to order the description of this parameter when usage() is invoked before the number order() is used.Class
<? extends IStringConverter<?>> The string converter to use for this field.Description of default value.A description of this option.The key used to find the string in the message bundle.boolean
If true, console will not echo typed input Used in conjunction with password = trueboolean
If true, this parameter can not be overwritten through a file or another appearance of the parameterboolean
If true, this parameter is for help.boolean
If true, this parameter won't appear in the usage().Class
<? extends IStringConverter<?>> The list string converter to use for this field.String[]
An array of allowed command line parameters (e.g.int
If specified, this number will be used to order the description of this parameter when usage() is invoked.boolean
If true, this parameter is a password and it will be prompted on the console (if available).boolean
Whether this option is required.Class
<? extends IParameterSplitter> What splitter to use (applicable only on fields of type List).Class<? extends IValueValidator>[]
Validate the value for this parameter.Class<? extends IParameterValidator>[]
Validate the parameter found on the command line.boolean
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
How many parameter values this parameter will consume.
-
Field Details
-
DEFAULT_ARITY
static final int DEFAULT_ARITYHow many parameter values this parameter will consume. For example, an arity of 2 will allow "-pair value1 value2".- See Also:
-
-
Element Details
-
names
String[] namesAn array of allowed command line parameters (e.g. "-d", "--outputdir", etc...). If this attribute is omitted, the field it's annotating will receive all the unparsed options. There can only be at most one such annotation.- Default:
{}
-
description
String descriptionA description of this option.- Default:
""
-
defaultValueDescription
String defaultValueDescriptionDescription of default value.- Default:
""
-
required
boolean requiredWhether this option is required.- Default:
false
-
descriptionKey
String descriptionKeyThe key used to find the string in the message bundle.- Default:
""
-
arity
int arity- Default:
-1
-
password
boolean passwordIf true, this parameter is a password and it will be prompted on the console (if available).- Default:
false
-
converter
Class<? extends IStringConverter<?>> converterThe string converter to use for this field. If the field is of type List and not listConverter attribute was specified, JCommander will split the input in individual values and convert each of them separately.- Default:
com.beust.jcommander.converters.NoConverter.class
-
listConverter
Class<? extends IStringConverter<?>> listConverterThe list string converter to use for this field. If it's specified, the field has to be of type List and the converter needs to return a List that's compatible with that type.- Default:
com.beust.jcommander.converters.NoConverter.class
-
validateWith
Class<? extends IParameterValidator>[] validateWithValidate the parameter found on the command line.- Default:
{com.beust.jcommander.validators.NoValidator.class}
-
validateValueWith
Class<? extends IValueValidator>[] validateValueWithValidate the value for this parameter.- Default:
{com.beust.jcommander.validators.NoValueValidator.class}
-
variableArity
boolean variableArity- Returns:
- true if this parameter has a variable arity. See @{IVariableArity}
- Default:
false
-
splitter
Class<? extends IParameterSplitter> splitterWhat splitter to use (applicable only on fields of type List). By default, a comma separated splitter will be used.- Default:
com.beust.jcommander.converters.CommaParameterSplitter.class
-
echoInput
boolean echoInputIf true, console will not echo typed input Used in conjunction with password = true- Default:
false
-
help
boolean helpIf true, this parameter is for help. If such a parameter is specified, required parameters are no longer checked for their presence.- Default:
false
-
forceNonOverwritable
boolean forceNonOverwritableIf true, this parameter can not be overwritten through a file or another appearance of the parameter- Returns:
- nc
- Default:
false
-
order
int orderIf specified, this number will be used to order the description of this parameter when usage() is invoked.- Returns:
- Default:
-1
-
category
String categoryIf specified, the category name will be used to order the description of this parameter when usage() is invoked before the number order() is used.- Returns:
- (default or specified) category name
- Default:
""
-