Top Description Methods
groovy.cli

public @Interface Option

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:METHOD, FIELD
Imports
groovy.transform.Undefined, java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Indicates that a method or property can be used to set a CLI option.

Method Summary

Modifier and TypeMethod and Description
public Class<T>

Returns:

the closure to convert this option's argument(s)
convert
()

A conversion closure to convert the incoming String into the desired object

public String

Returns:

the default value for this option
defaultValue
()

The default value for this option as a String; subject to type conversion and 'convert'.

public String

Returns:

the description of this option
description
()

The description of this option

public String

Returns:

the long name of this option
longName
()

The long name of this option.

public int

Returns:

the number of arguments
numberOfArguments
()

How many arguments this option has.

public String

Returns:

the number of arguments (as a String)
numberOfArgumentsString
()

How many arguments this option has represented as a String.

public boolean

Returns:

true if this array-typed option can have an optional argument (i.e. could be empty)
optionalArg
()

Whether this option can have an optional argument.

public String

Returns:

the short name of this option
shortName
()

The short name of this option.

public String

Returns:

the value separator for this multi-valued option
valueSeparator
()

The value separator for this multi-valued option.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

convertback to summary
public Class<T> convert()

A conversion closure to convert the incoming String into the desired object

Returns:Class<T>

the closure to convert this option's argument(s)

defaultValueback to summary
public String defaultValue()

The default value for this option as a String; subject to type conversion and 'convert'. Ignored for Boolean options.

Returns:String

the default value for this option

descriptionback to summary
public String description()

The description of this option

Returns:String

the description of this option

longNameback to summary
public String longName()

The long name of this option. Defaults to the name of member being annotated.

Returns:String

the long name of this option

numberOfArgumentsback to summary
public int numberOfArguments()

How many arguments this option has. A value greater than 1 is only allowed for array-typed arguments. Ignored for boolean options which are assumed to have a default of 0 or if numberOfArgumentsString is set.

Returns:int

the number of arguments

numberOfArgumentsStringback to summary
public String numberOfArgumentsString()

How many arguments this option has represented as a String. Only allowed for array-typed arguments. Overrides numberOfArguments if set. The special values of '+' means one or more and '*' as 0 or more.

Returns:String

the number of arguments (as a String)

optionalArgback to summary
public boolean optionalArg()

Whether this option can have an optional argument. Only supported for array-typed arguments to indicate that the array may be empty.

Returns:boolean

true if this array-typed option can have an optional argument (i.e. could be empty)

shortNameback to summary
public String shortName()

The short name of this option. Defaults to the name of member being annotated if the longName is empty.

Returns:String

the short name of this option

valueSeparatorback to summary
public String valueSeparator()

The value separator for this multi-valued option. Only allowed for array-typed arguments.

Returns:String

the value separator for this multi-valued option