Top Fields Methods
com.beust.jcommander

public @Interface Parameter

extends Annotation
Annotations
@Retention:RUNTIME
@Target:FIELD, METHOD
Static Imports
java.lang.annotation.ElementType.FIELD, .ElementType.METHOD

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_ARITY

How many parameter values this parameter will consume.

Method Summary

Modifier and TypeMethod and Description
public int
public Class<? extends IStringConverter<?>>
converter()

The string converter to use for this field.

public String
description()

A description of this option.

public String
descriptionKey()

The key used to find the string in the message bundle.

public boolean
echoInput()

If true, console will not echo typed input Used in conjunction with password = true

public boolean

Returns:

nc
forceNonOverwritable
()

If true, this parameter can be overwritten through a file or another appearance of the parameter

public boolean
help()

If true, this parameter is for help.

public boolean
hidden()

If true, this parameter won't appear in the usage().

public Class<? extends IStringConverter<?>>
listConverter()

The list string converter to use for this field.

public String[]
names()

An array of allowed command line parameters (e.g. "-d", "--outputdir", etc...).

public int
order()

If specified, this number will be used to order the description of this parameter when usage() is invoked.

public boolean
password()

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

public boolean
required()

Whether this option is required.

public Class<? extends IParameterSplitter>
splitter()

What splitter to use (applicable only on fields of type List).

public Class<? extends IValueValidator<T>>[]
validateValueWith()

Validate the value for this parameter.

public Class<? extends IParameterValidator>[]
validateWith()

Validate the parameter found on the command line.

public boolean

Returns:

true if this parameter has a variable arity. See @{IVariableArity}
variableArity
()

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Field Detail

DEFAULT_ARITYback to summary
public static final int DEFAULT_ARITY

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

Method Detail

arityback to summary
public int arity()
converterback to summary
public 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.

descriptionback to summary
public String description()

A description of this option.

descriptionKeyback to summary
public String descriptionKey()

The key used to find the string in the message bundle.

echoInputback to summary
public boolean echoInput()

If true, console will not echo typed input Used in conjunction with password = true

forceNonOverwritableback to summary
public boolean forceNonOverwritable()

If true, this parameter can be overwritten through a file or another appearance of the parameter

Returns:boolean

nc

helpback to summary
public boolean help()

If true, this parameter is for help. If such a parameter is specified, required parameters are no longer checked for their presence.

hiddenback to summary
public boolean hidden()

If true, this parameter won't appear in the usage().

listConverterback to summary
public 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.

namesback to summary
public 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.

orderback to summary
public int order()

If specified, this number will be used to order the description of this parameter when usage() is invoked.

passwordback to summary
public boolean password()

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

requiredback to summary
public boolean required()

Whether this option is required.

splitterback to summary
public Class<? extends IParameterSplitter> splitter()

What splitter to use (applicable only on fields of type List). By default, a comma separated splitter will be used.

validateValueWithback to summary
public Class<? extends IValueValidator<T>>[] validateValueWith()

Validate the value for this parameter.

validateWithback to summary
public Class<? extends IParameterValidator>[] validateWith()

Validate the parameter found on the command line.

variableArityback to summary
public boolean variableArity()
Returns:boolean

true if this parameter has a variable arity. See @{IVariableArity}