Annotation Type Option
Marks a property of a Task
as being configurable from the command-line.
This annotation should be attached to a field or a setter method. When attached to a field, option()
will use the name of the field by default. When attached to a method, option()
must be specified.
An option may have one of the following types:
boolean
,Boolean
, orProperty<Boolean>
Double
orProperty<Double>
Integer
orProperty<Integer>
Long
orProperty<Long>
String
orProperty<String>
- an
enum
type orProperty<T>
of an enum type List<T>
of typeDouble
,Integer
,Long
,String
, or anenum
typeListProperty<T>
andSetProperty<T>
of same type asList<T>
DirectoryProperty
orRegularFileProperty
Note: Multiple @Option
s with the same names are disallowed on different methods/fields.
Methods with the same signature (i.e. the same name, return type, and parameter types) are allowed to use
equal or unequal option names.
When the option names are equal, the description and method linked to the option will be the one in the base class (if present), followed by super-classes, and finally interfaces, in an unspecified order.
When the option names are unequal, the order described above is used when setting the option's value. If the base class has an option with the name "foo" and an interface has an option with the name "bar", the option "foo" will have precedence over the option "bar" and setting both will result in the value of "foo".
Depending on this behavior is discouraged. It is only in place to allow legacy migration to interface options.
- Since:
- 4.6
-
Required Element Summary
-
Optional Element Summary
-
Element Details
-
description
String descriptionThe description of this option.- Returns:
- The description.
-
-
-
option
String optionThe option to map to this property. Required when annotating a method. May be omitted when annotating a field in which case the field's name will be used.- Returns:
- The option.
- Default:
- ""
-