Package: groovy.cli

## [Java] Annotation Type Option

- groovy.cli.Option

- Indicates that a method or property can be used to set a CLI option.

- - ### Element Summary

    Optional Element Summary
    Type | Name and Description
    --- | ---
    `Class` | `convert` A conversion closure to convert the incoming String into the desired object
    `String` | `defaultValue` The default value for this option as a String; subject to type conversion and 'convert'.
    `String` | `description` The description of this option
    `String` | `longName` The long name of this option.
    `int` | `numberOfArguments` How many arguments this option has.
    `String` | `numberOfArgumentsString` How many arguments this option has represented as a String.
    `boolean` | `optionalArg` Whether this option can have an optional argument.
    `String` | `shortName` The short name of this option.
    `String` | `valueSeparator` The value separator for this multi-valued option.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Element Detail

    - #### public Class convert

      A conversion closure to convert the incoming String into the desired object @default .CLASS.class

      Returns:
        the closure to convert this option's argument(s)

    - #### public String defaultValue

      The default value for this option as a String; subject to type conversion and 'convert'. Ignored for Boolean options. @default ""

      Returns:
        the default value for this option

    - #### public String description

      The description of this option @default ""

      Returns:
        the description of this option

    - #### public String longName

      The long name of this option. Defaults to the name of member being annotated. @default ""

      Returns:
        the long name of this option

    - #### public int numberOfArguments

      How many arguments this option has. A value greater than 1 is only allowed for array-typed arguments. Ignored for boolean options which are assumed to have a default of 0 or if `numberOfArgumentsString` is set. @default 1

      Returns:
        the number of arguments

    - #### public String numberOfArgumentsString

      How many arguments this option has represented as a String. Only allowed for array-typed arguments. Overrides `numberOfArguments` if set. The special values of '+' means one or more and '*' as 0 or more. @default ""

      Returns:
        the number of arguments (as a String)

    - #### public boolean optionalArg

      Whether this option can have an optional argument. Only supported for array-typed arguments to indicate that the array may be empty. @default false

      Returns:
        true if this array-typed option can have an optional argument (i.e. could be empty)

    - #### public String shortName

      The short name of this option. Defaults to the name of member being annotated if the longName is empty. @default ""

      Returns:
        the short name of this option

    - #### public String valueSeparator

      The value separator for this multi-valued option. Only allowed for array-typed arguments. @default ""

      Returns:
        the value separator for this multi-valued option