com.beust.jcommander
Annotation Type Parameter


@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Parameter


Optional Element Summary
 int arity
          How many parameter values this parameter will consume.
 Class<? extends IStringConverter<?>> converter
          The string converter to use for this field.
 String description
          A description of this option.
 String descriptionKey
          The key used to find the string in the message bundle.
 boolean hidden
          If true, this parameter won't appear in the usage().
 Class<? extends IStringConverter<?>> listConverter
          The list string converter to use for this field.
 String[] names
          An array of allowed command line parameters (e.g.
 boolean password
          If true, this parameter is a password and it will be prompted on the console (if available).
 boolean required
          Whether this option is required.
 Class<? extends IParameterSplitter> splitter
          What splitter to use (applicable only on fields of type List).
 Class<? extends IParameterValidator> validateWith
          The validation class to use.
 boolean variableArity
           
 

names

public abstract String[] names
An 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

public abstract String description
A description of this option.

Default:
""

required

public abstract boolean required
Whether this option is required.

Default:
false

descriptionKey

public abstract String descriptionKey
The key used to find the string in the message bundle.

Default:
""

arity

public abstract int arity
How many parameter values this parameter will consume. For example, an arity of 2 will allow "-pair value1 value2".

Default:
-1

password

public abstract boolean password
If true, this parameter is a password and it will be prompted on the console (if available).

Default:
false

converter

public abstract Class<? extends IStringConverter<?>> converter
The 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

public abstract Class<? extends IStringConverter<?>> listConverter
The 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

hidden

public abstract boolean hidden
If true, this parameter won't appear in the usage().

Default:
false

validateWith

public abstract Class<? extends IParameterValidator> validateWith
The validation class to use.

Default:
com.beust.jcommander.validators.NoValidator.class

variableArity

public abstract boolean variableArity
Returns:
true if this parameter has a variable arity. See @{IVariableArity}
Default:
false

splitter

public abstract Class<? extends IParameterSplitter> splitter
What 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


Copyright © 2012. All Rights Reserved.