vertx / io.vertx.core.cli.annotations / Option

Option

@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) class Option

Annotates a setter to be called with the value of a command line option. Setter have been preferred to field to allow validation. The cardinality of the option is detected from the single method parameter type: arrays, list and set can receive several values.

Author
Clement Escoffier

See Also
Argument

Constructors

<init>

Option(longName: String, shortName: String, argName: String, required: Boolean, acceptValue: Boolean, acceptMultipleValues: Boolean, flag: Boolean, help: Boolean, choices: Array<String>)

Annotates a setter to be called with the value of a command line option. Setter have been preferred to field to allow validation. The cardinality of the option is detected from the single method parameter type: arrays, list and set can receive several values.

Properties

NO_NAME

static val NO_NAME: String

acceptMultipleValues

val acceptMultipleValues: Boolean

Whether or not the option accept multiple values. If the setter accepts an array, a list, a set, or a collection as parameter, it automatically detect it accepts multiple values.

acceptValue

val acceptValue: Boolean

Whether or not the option accept a value. If the setter accepts an array, a list, a set, or a collection as parameter, it automatically detect it accepts multiple values.

argName

val argName: String

The name of this argument (used in doc)

choices

val choices: Array<String>

The set of choices accepted as values by this option. No need to call this methods for enums.

flag

val flag: Boolean

Whether or not the option can be used as a flag (meaning no value)

help

val help: Boolean

Whether or not this option is a "Help" option. Help options are generally flag.

longName

val longName: String

The name of the option (without the -- prefix). Defaults to a name based on the setter name

required

val required: Boolean

Whether or not the option is required.

shortName

val shortName: String

The short option name (without the - prefix). If not given the option has no short name.