org.crosswire.common.options
Class Option

java.lang.Object
  extended by 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.

Author:
DM Smith
See Also:
The GNU Lesser General Public License for details.

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

Copyright ยจ 2003-2015