Annotation Interface Option


@Retention(RUNTIME) @Target(FIELD) @Documented public @interface Option
Annotation to mark a field as an option
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    An array of allowed command line parameters e.g.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    How many parameter values this option will consume.
    A description of this option.
    boolean
    If true, this parameter won't appear in the usage().
    boolean
    If true this parameter can override parameters of the same name (set via the name() property) declared by parent classes assuming the option definitions are compatible.
    boolean
    If true this parameter cannot be overridden by parameters of the same name declared in child classes regardless of whether the child class declares the override() property to be true
    Name use to identify the option value in documentation and error messages
    Is this a command, group or global option
    Sets an alternative type converter provider for the option.
  • Element Details

    • type

      Is this a command, group or global option
      Returns:
      Option type
      Default:
      COMMAND
    • title

      String[] title
      Name use to identify the option value in documentation and error messages

      If your option has arity() greater than 1 then you can specify titles for each parameter by specifying an array of titles. If there are fewer titles than the arity then the last title in the list will be used for all subsequent options

      Returns:
      Title
      Default:
      {""}
    • name

      String[] name
      An array of allowed command line parameters e.g. -n, --name, etc...
      Returns:
      Names
    • description

      String description
      A description of this option.
      Returns:
      Description
      Default:
      ""
    • arity

      int arity
      How many parameter values this option will consume. For example, an arity of 2 will allow -pair value1 value2
      Returns:
      Arity
      Default:
      -2147483648
    • hidden

      boolean hidden
      If true, this parameter won't appear in the usage().
      Returns:
      True if hidden, false otherwise
      Default:
      false
    • override

      boolean override
      If true this parameter can override parameters of the same name (set via the name() property) declared by parent classes assuming the option definitions are compatible.

      See OptionMetadata.override(java.util.Set, OptionMetadata, OptionMetadata) for legal overrides

      Note that where the child option definition is an exact duplicate of the parent then overriding is implicitly permitted

      Returns:
      True if an override, false otherwise
      Default:
      false
    • sealed

      boolean sealed
      If true this parameter cannot be overridden by parameters of the same name declared in child classes regardless of whether the child class declares the override() property to be true
      Returns:
      True if sealed, false otherwise
      Default:
      false
    • typeConverterProvider

      Class<? extends TypeConverterProvider> typeConverterProvider
      Sets an alternative type converter provider for the option. This allows the type converter for an option to be customised appropriately. By default this will defer to using the type converter provided in the parser configuration.
      Returns:
      Type converter provider
      Default:
      com.github.rvesse.airline.types.DefaultTypeConverterProvider.class