public @interface Option
|Modifier and Type
|Required Element and Description
The default value for the option.
The name of the option ("--name").
|Modifier and Type
|Optional Element and Description
The single-character abbreviation of the option ("-abbrev").
A flag indicating whether the option type should be allowed to occur multiple times in a single option list.
A string describing the category of options that this belongs to.
java.lang.Class<? extends Converter>
The converter that we'll use to convert this option into an object or a simple type.
If this field is a non-empty string, the option is deprecated, and a deprecation warning is added to the list of warnings when such an option is used.
If the option is actually an abbreviation for other options, this field will contain the strings to expand this option into.
A help string for the usage information.
If the option requires that additional options be implicitly appended, this field will contain the additional options.
The old name for this option.
A short text string to describe the type of the expected value.
Indicates that this option is a wrapper for other options, and will be unwrapped when parsed.
public abstract java.lang.String defaultValue
There are two reasons this is a string. Firstly, it ensures that
explicitly specifying this option at its default value (as printed in the
usage message) has the same behavior as not specifying the option at all;
this would be very hard to achieve if the default value was an instance of
type T, since we'd need to ensure that
converter() were dual to each other. The second reason is more mundane
but also more restrictive: annotation values must be compile-time
If an option's defaultValue() is the string "null", the option's converter will not be invoked to interpret it; a null reference will be used instead. (It would be nice if defaultValue could simply return null, but bizarrely, the Java Language Specification does not consider null to be a compile-time constant.) This special interpretation of the string "null" is only applicable when computing the default value; if specified on the command-line, this string will have its usual literal meaning.
The default value for flags that set allowMultiple is always the empty list and its default value is ignored.
public abstract char abbrev
public abstract java.lang.String valueHelp
is ignored for boolean, tristate, boolean_or_enum, and void options.
public abstract java.lang.String category
OptionsParser.describeOptions(java.util.Map<java.lang.String, java.lang.String>, com.google.devtools.common.options.OptionsParser.HelpVerbosity) prints options of the same category grouped
public abstract java.lang.Class<? extends Converter> converter
public abstract boolean allowMultiple
If the command can occur multiple times, then the attribute value
must be a list type
List<T>, and the result type of the
converter for this option must either match the parameter
List<T>. In the latter case the individual lists are concatenated
to form the full options value.
defaultValue() field of the annotation is ignored for repeatable
flags and the default value will be the empty list.
public abstract java.lang.String expansion
An expanded option overrides previously specified options of the same name,
even if it is explicitly specified. This is the original behavior and can
be surprising if the user is not aware of it, which has led to several
requests to change this behavior. This was discussed in the blaze team and
it was decided that it is not a strong enough case to change the behavior.
public abstract java.lang.String implicitRequirements
OptionsParser.parse(java.lang.String...) invocation, and override options specified in
the same call. However, they can be overridden by options specified in a later
call or by options with a higher priority.
public abstract java.lang.String deprecationWarning
public abstract java.lang.String oldName
public abstract boolean wrapperOption
Void (if it is something other
than Void, the parser will not assign a value to it). The
attributes will not be processed. Wrapper options are implicitly repeatable (i.e., as though
allowMultiple() is true regardless of its value in the annotation).
Wrapper options are provided only for transitioning flags which appear as values to other flags, to top-level flags. Wrapper options should not be used in Invocation Policy, as expansion flags to other flags, or as implicit requirements to other flags. Use the inner flags instead.