Option

public abstract @interface Option
implements Annotation

com.android.tradefed.config.Option


Annotates a field as representing a IConfiguration option.

Summary

Nested classes

enum Option.Importance

 

Constants

char NO_SHORT_NAME

Public methods

String description()

User friendly description of the option.

Option.Importance importance()

The importance of the option.

boolean isTimeVal()

Whether the option represents a time value.

boolean mandatory()

Whether the option is mandatory or optional.

String name()

The mandatory unique name for this option.

char shortName()

Optional abbreviated name for option.

OptionUpdateRule updateRule()

Controls the behavior when an option is specified multiple times.

Constants

NO_SHORT_NAME

char NO_SHORT_NAME

Constant Value: 48 (0x00000030)

Public methods

description

String description ()

User friendly description of the option.

Returns
String

importance

Option.Importance importance ()

The importance of the option.

An option deemed 'important' will be displayed in the abbreviated help output. Help for an unimportant option will only be displayed in the full help text.

Returns
Option.Importance

isTimeVal

boolean isTimeVal ()

Whether the option represents a time value.

If this is a time value, time-specific suffixes will be parsed. The field MUST be a long or Long for this flag to be valid. A ConfigurationException will be thrown otherwise.

The default unit is millis. The configuration framework will accept s for seconds (1000 millis), m for minutes (60 seconds), h for hours (60 minutes), or d for days (24 hours).

Units may be mixed and matched, so long as each unit appears at most once, and so long as all units which do appear are listed in decreasing order of scale. So, for instance, h may only appear before m, and may only appear after d. As a specific example, "1d2h3m4s5ms" would be a valid time value, as would "4" or "4ms". All embedded whitespace is discarded.

Returns
boolean

mandatory

boolean mandatory ()

Whether the option is mandatory or optional.

The configuration framework will throw a ConfigurationException if either of the following is true of a mandatory field after options have been parsed from all sources:

  • The field is null.
  • The field is an empty Collection.

Returns
boolean

name

String name ()

The mandatory unique name for this option.

This will map to a command line argument prefixed with two '-' characters. For example, an Option with name 'help' would be specified with '--help' on the command line.

Names may not contain a colon eg ':'.

Returns
String

shortName

char shortName ()

Optional abbreviated name for option. This will map to a command line argument prefixed with a single '-'. e.g. "-h" where h = shortName. '0' is reserved to mean the option has no shortName.

Returns
char

updateRule

OptionUpdateRule updateRule ()

Controls the behavior when an option is specified multiple times. Note that this rule is ignored completely for options that are Collections or Maps.

Returns
OptionUpdateRule