Package jargs.gnu

# Class CmdLineParser.Option

java.lang.Object
jargs.gnu.CmdLineParser.Option

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `CmdLineParser.Option.BooleanOption`, `CmdLineParser.Option.DoubleOption`, `CmdLineParser.Option.IntegerOption`, `CmdLineParser.Option.LongOption`, `CmdLineParser.Option.StringOption`

Enclosing class:
  CmdLineParser

public abstract static class CmdLineParser.Option extends Object implements Serializable
Representation of a command-line option.

See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `CmdLineParser.Option.BooleanOption`
  The Class BooleanOption.
  `static class`
  `CmdLineParser.Option.DoubleOption`
  An option that expects a floating-point value.
  `static class`
  `CmdLineParser.Option.IntegerOption`
  An option that expects an integer value.
  `static class`
  `CmdLineParser.Option.LongOption`
  An option that expects a long integer value.
  `static class`
  `CmdLineParser.Option.StringOption`
  An option that expects a string value.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Option(char shortForm, String longForm, boolean wantsValue)`
  Instantiates a new option.
  `protected`
  `Option(String longForm, boolean wantsValue)`
  Instantiates a new option.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Object`
  `getValue(String arg, Locale locale)`
  Gets the value.
  `String`
  `longForm()`
  Long form.
  `protected Object`
  `parseValue(String arg, Locale locale)`
  Override to extract and convert an option value passed on the command-line.
  `String`
  `shortForm()`
  Short form.
  `boolean`
  `wantsValue()`
  Tells whether or not this option wants a value.

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

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

- ## Constructor Details

  - ### Option

    protected Option(String longForm, boolean wantsValue)
    Instantiates a new option.
    Parameters:
      `longForm` - the long form
      `wantsValue` - the wants value

  - ### Option

    protected Option(char shortForm, String longForm, boolean wantsValue)
    Instantiates a new option.
    Parameters:
      `shortForm` - the short form
      `longForm` - the long form
      `wantsValue` - the wants value

- ## Method Details

  - ### shortForm

    public String shortForm()
    Short form.
    Returns:
      the string

  - ### longForm

    public String longForm()
    Long form.
    Returns:
      the string

  - ### wantsValue

    public boolean wantsValue()
    Tells whether or not this option wants a value.
    Returns:
      true, if successful

  - ### getValue

    public final Object getValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
    Gets the value.
    Parameters:
      `arg` - the arg
      `locale` - the locale
    Returns:
      the value
    Throws:
      `CmdLineParser.IllegalOptionValueException` - the illegal option value exception

  - ### parseValue

    protected Object parseValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException
    Override to extract and convert an option value passed on the command-line.
    Parameters:
      `arg` - the arg
      `locale` - the locale
    Returns:
      the object
    Throws:
      `CmdLineParser.IllegalOptionValueException` - the illegal option value exception