CommandLine.Arity (picocli 0.9.6 API)
Date: 2017-05-25

picocli

## Class CommandLine.Arity

- java.lang.Object
- - picocli.CommandLine.Arity

- Enclosing class:
    CommandLine

      public static class CommandLine.Arity
      extends java.lang.Object

  Describes the number of parameters required and accepted by an option or a positional parameter.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `isVariable`
    `int` | `max` Maximum accepted number of parameters for an option or positional parameter.
    `int` | `min` Required number of parameters for an option or positional parameter.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Arity(int min, int max, boolean variable, boolean unspecified, java.lang.String originalValue)` Constructs a new Arity object with the specified parameters.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object object)`
    `static CommandLine.Arity` | `forOption(java.lang.reflect.Field field)` Returns a new `Arity` based on the Option annotation on the specified field, or the field type if no arity was specified.
    `static CommandLine.Arity` | `forParameters(java.lang.reflect.Field field)` Returns a new `Arity` based on the Parameters annotation on the specified field, or the field type if no arity was specified.
    `static CommandLine.Arity` | `forType(java.lang.Class<?> type)` Returns a new `Arity` based on the specified type: booleans have arity 0, arrays or Collections have arity "0..*", and other types have arity 1.
    `int` | `hashCode()`
    `CommandLine.Arity` | `max(int newMax)` Returns a new Arity object with the `max` value replaced by the specified value.
    `CommandLine.Arity` | `min(int newMin)` Returns a new Arity object with the `min` value replaced by the specified value.
    `java.lang.String` | `toString()`
    `static CommandLine.Arity` | `valueOf(java.lang.String arity)` Leniently parses the specified String as an `Arity` value and return the result.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### min

          public final int min

      Required number of parameters for an option or positional parameter.

    - #### max

          public final int max

      Maximum accepted number of parameters for an option or positional parameter.

    - #### isVariable

          public final boolean isVariable

  - ### Constructor Detail

    - #### Arity

          public Arity(int min,
                       int max,
                       boolean variable,
                       boolean unspecified,
                       java.lang.String originalValue)

      Constructs a new Arity object with the specified parameters.
      Parameters:
        `min` - minimum number of required parameters
        `max` - maximum number of allowed parameters (or Integer.MAX_VALUE if variable)
        `variable` - `true` if any number or parameters is allowed, `false` otherwise
        `unspecified` - `true` if no arity was specified on the option/parameter (value is based on type)
        `originalValue` - the original value that was specified on the option or parameter

  - ### Method Detail

    - #### forOption

          public static CommandLine.Arity forOption(java.lang.reflect.Field field)

      Returns a new `Arity` based on the Option annotation on the specified field, or the field type if no arity was specified.
      Parameters:
        `field` - the field whose Option annotation to inspect
      Returns:
        a new `Arity` based on the Option annotation on the specified field

    - #### forParameters

          public static CommandLine.Arity forParameters(java.lang.reflect.Field field)

      Returns a new `Arity` based on the Parameters annotation on the specified field, or the field type if no arity was specified.
      Parameters:
        `field` - the field whose Parameters annotation to inspect
      Returns:
        a new `Arity` based on the Parameters annotation on the specified field

    - #### forType

          public static CommandLine.Arity forType(java.lang.Class<?> type)

      Returns a new `Arity` based on the specified type: booleans have arity 0, arrays or Collections have arity "0..*", and other types have arity 1.
      Parameters:
        `type` - the type whose default arity to return
      Returns:
        a new `Arity` based on the specified type

    - #### valueOf

          public static CommandLine.Arity valueOf(java.lang.String arity)

      Leniently parses the specified String as an `Arity` value and return the result. An arity string can be a fixed integer value or a range of the form `MIN_VALUE + ".." + MAX_VALUE`. If the `MIN_VALUE` string is not numeric, the minimum is zero. If the `MAX_VALUE` is not numeric, the arity is taken to be variable and the maximum is `Integer.MAX_VALUE`.
      Parameters:
        `arity` - the arity string to parse
      Returns:
        a new `Arity` value

    - #### min

          public CommandLine.Arity min(int newMin)

      Returns a new Arity object with the `min` value replaced by the specified value.
      Parameters:
        `newMin` - the `min` value of the returned Arity object
      Returns:
        a new Arity object with the specified `min` value, all other values are kept

    - #### max

          public CommandLine.Arity max(int newMax)

      Returns a new Arity object with the `max` value replaced by the specified value.
      Parameters:
        `newMax` - the `max` value of the returned Arity object
      Returns:
        a new Arity object with the specified `max` value, all other values are kept

    - #### equals

          public boolean equals(java.lang.Object object)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`