org.apache.ode.utils.cli

## Class Argument

- java.lang.Object
- - org.apache.ode.utils.cli.Argument

- All Implemented Interfaces:
    CommandlineFragment
  Direct Known Subclasses:
    LastArgument

      public class Argument
      extends java.lang.Object
      implements CommandlineFragment

  Models an argument, e.g., the `baz` in `foo baz`, where `foo` is the command.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.ode.utils.cli.CommandlineFragment

      `COMMAND_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Argument(java.lang.String argName, java.lang.String description, boolean optional)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<java.lang.String>` | `consume(java.util.List<java.lang.String> s)` Grab the pieces of the commandline relevant to this argument, configure the implementation, and then return a new array of arguments that will have the pieces of the original commandline that this command used removed.
    `java.lang.String` | `getDescription()` Return a description of this commandline fragment.
    `java.lang.String` | `getUsage()` Construct a usage string for this commandline fragment.
    `java.lang.String` | `getValue()`
    `boolean` | `isOptional()`
    `boolean` | `isSet()`
    `void` | `reset()` Reset the fragment to its initial state.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Argument

          public Argument(java.lang.String argName,
                          java.lang.String description,
                          boolean optional)

  - ### Method Detail

    - #### reset

          public void reset()

      Description copied from interface: `CommandlineFragment`

      Reset the fragment to its initial state. This is useful for reusing fragments in multiple commandline structures.

      Specified by:
        `reset` in interface `CommandlineFragment`

    - #### consume

          public java.util.List<java.lang.String> consume(java.util.List<java.lang.String> s)
                                                   throws CommandlineSyntaxException

      Description copied from interface: `CommandlineFragment`

      Grab the pieces of the commandline relevant to this argument, configure the implementation, and then return a new array of arguments that will have the pieces of the original commandline that this command used removed.

      Specified by:
        `consume` in interface `CommandlineFragment`
      Parameters:
        `s` - the list of arguments
      Returns:
        the list of arguments, post parse
      Throws:
        `CommandlineSyntaxException` - if the commandline is structurally invalid.

    - #### isOptional

          public boolean isOptional()

      Specified by:
        `isOptional` in interface `CommandlineFragment`
      Returns:
        `true` if this fragment is optional.

    - #### isSet

          public boolean isSet()

    - #### getValue

          public java.lang.String getValue()

    - #### getUsage

          public java.lang.String getUsage()

      Description copied from interface: `CommandlineFragment`

      Construct a usage string for this commandline fragment. The usage string is used when constructing a strawman commandline example and when formatting help.

      Specified by:
        `getUsage` in interface `CommandlineFragment`
      Returns:
        the usage string

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from interface: `CommandlineFragment`

      Return a description of this commandline fragment. The description should be a (short) narrative item that describes the purpose of the fragment. It is only used when formatting help.

      Specified by:
        `getDescription` in interface `CommandlineFragment`
      Returns:
        the description