Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.options
Class Option

    java.lang.Object
      org.crosswire.common.options.Option

    public class Option

extends Object

An Option is representation of a single named parameter. An Option has a short, or a long name, or both.

It's inspiration was for command-line argument processing, but it can be used for any other purpose.

- An Option has a description, suitable for a usage statement.
- An Option's argument can be optional, required or unexpected. Default is NO_ARGUMENT.
- An Option can have an argument of a type. Default is DataType.BOOLEAN.
- An Option can have short name consisting of a single character.
- An Option can have a long name given by any string. What is allowed in the long name is dependent upon usage, but typically does not allow spaces.
- An Option can have a default value. Default is no default value.

Author:
  DM Smith [dmsmith555 at yahoo dot com]
See Also:
  `for license details.
  The copyright to this program is held by it's authors.`

Field Summary
`private ArgumentType` | `argumentType`
`private DataType` | `dataType`
`private String` | `defaultValue`
`private String` | `description`
`private String` | `longName`
`private char` | `shortName`

Constructor Summary
`Option(String description, ArgumentType argumentType, DataType dataType, char shortName)` Create an Option with a short name, having no default value.
`Option(String description, ArgumentType argumentType, DataType dataType, char shortName, String longName)` Create an Option with both short and long names, having no default value.
`Option(String description, ArgumentType argumentType, DataType dataType, char shortName, String longName, String defaultValue)` Create an Option with both short and long names of a given DataType having a default value.
`Option(String description, ArgumentType argumentType, DataType dataType, String longName)` Create an Option with a long name, having no default value.
`Option(String description, char shortName)` Create a BOOLEAN Option with a short name, having no default value.
`Option(String description, char shortName, String longName)` Create a BOOLEAN Option with both short and long names, having no default value.
`Option(String description, char shortName, String longName, String defaultValue)` Create an Option with both short and long names of a given DataType having a default value.
`Option(String description, String longName)` Create a BOOLEAN Option with a long name, having no default value.

Method Summary
`ArgumentType` | `getArgumentType()` The ArgumentType indicates this Option's ability to use a following argument.
`DataType` | `getDataType()`
`String` | `getDefaultValue()`
`String` | `getDescription()` The description provides a brief explanation of the option.
`String` | `getLongName()` The long name of an Option is the single character by which this Option is known.
`char` | `getShortName()` The short name of an Option is the single character by which this Option is known.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### description

    private String description

### shortName

    private char shortName

### longName

    private String longName

### dataType

    private DataType dataType

### argumentType

    private ArgumentType argumentType

### defaultValue

    private String defaultValue

Constructor Detail

### Option

    public Option(String description,
                  char shortName)

  Create a BOOLEAN Option with a short name, having no default value.

  Parameters:
    `description` - the description
    `shortName` - the short name

### Option

    public Option(String description,
                  String longName)

  Create a BOOLEAN Option with a long name, having no default value.

  Parameters:
    `description` - the description
    `longName` - the long name

### Option

    public Option(String description,
                  char shortName,
                  String longName)

  Create a BOOLEAN Option with both short and long names, having no default value.

  Parameters:
    `description` - the description
    `shortName` - the short name
    `longName` - the long name

### Option

    public Option(String description,
                  char shortName,
                  String longName,
                  String defaultValue)

  Create an Option with both short and long names of a given DataType having a default value.

  Parameters:
    `description` - the description
    `shortName` - the short name
    `longName` - the long name
    `defaultValue` - the default value for this Option

### Option

    public Option(String description,
                  ArgumentType argumentType,
                  DataType dataType,
                  char shortName)

  Create an Option with a short name, having no default value.

  Parameters:
    `description` - the description
    `argumentType` - the type of the argument
    `dataType` - the type of argument's data
    `shortName` - the short name

### Option

    public Option(String description,
                  ArgumentType argumentType,
                  DataType dataType,
                  String longName)

  Create an Option with a long name, having no default value.

  Parameters:
    `description` - the description
    `argumentType` - the type of the argument
    `dataType` - the type of argument's data
    `longName` - the long name

### Option

    public Option(String description,
                  ArgumentType argumentType,
                  DataType dataType,
                  char shortName,
                  String longName)

  Create an Option with both short and long names, having no default value.

  Parameters:
    `description` - the description
    `argumentType` - the type of the argument
    `dataType` - the type of argument's data
    `shortName` - the short name
    `longName` - the long name

### Option

    public Option(String description,
                  ArgumentType argumentType,
                  DataType dataType,
                  char shortName,
                  String longName,
                  String defaultValue)

  Create an Option with both short and long names of a given DataType having a default value.

  Parameters:
    `description` - the description
    `argumentType` - the type of the argument
    `dataType` - the type of argument's data
    `shortName` - the short name
    `longName` - the long name
    `defaultValue` - the default value for this Option

Method Detail

### getDescription

    public String getDescription()

  The description provides a brief explanation of the option.

  Returns:
    the description

### getShortName

    public char getShortName()

  The short name of an Option is the single character by which this Option is known. If it is not set then there is no short name for this Option.

  Returns:
    the shortName

### getLongName

    public String getLongName()

  The long name of an Option is the single character by which this Option is known. If it is not set then there is no long name for this Option.

  Returns:
    the longName

### getArgumentType

    public ArgumentType getArgumentType()

  The ArgumentType indicates this Option's ability to use a following argument.

  Returns:
    the argumentType

### getDataType

    public DataType getDataType()

  Returns:
    the dataType

### getDefaultValue

    public String getDefaultValue()

  Returns:
    the defaultValue

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2007
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD