public class EnumOption extends Option
Constructor and Description |
---|
EnumOption(OptionGroup group,
java.lang.String name,
java.lang.String shortDescription,
java.lang.String flag,
java.lang.String usage)
Creates an enumerate option description
|
Modifier and Type | Method and Description |
---|---|
void |
addLegalValue(java.lang.String value)
Adds a legal value without a description
|
void |
addLegalValue(java.lang.String value,
java.lang.String desc)
Adds a legal value
|
java.lang.Object |
getDefaultValueObject()
Returns the object for the default value for option.
|
java.lang.String |
getDefaultValueString()
Returns a string representation of the default value.
|
java.lang.String |
getStringRepresentation(java.lang.Object value)
Returns a string representation of the option value.
|
java.lang.Object |
getValueObject(java.lang.String value)
Returns the corresponding object for the option value (specified as a string value).
|
void |
setDefaultValue(java.lang.String defaultValue)
Sets the default value for the option.
|
java.lang.String |
toString() |
compareTo, getFlag, getGroup, getName, getShortDescription, getUsage, isAmbiguous, setAmbiguous, setFlag, setUsage, setUsage
public EnumOption(OptionGroup group, java.lang.String name, java.lang.String shortDescription, java.lang.String flag, java.lang.String usage) throws MaltChainedException
group
- a reference to the option group.name
- the name of the option.shortDescription
- a short description of the option.flag
- a short string that can be used in the command line.usage
- a string that explains the usage of the option.OptionException
MaltChainedException
public java.lang.Object getValueObject(java.lang.String value) throws MaltChainedException
Option
getValueObject
in class Option
value
- the string option valueOptionException
MaltChainedException
public java.lang.Object getDefaultValueObject() throws MaltChainedException
Option
getDefaultValueObject
in class Option
OptionException
MaltChainedException
public java.lang.String getDefaultValueString()
Option
getDefaultValueString
in class Option
public void setDefaultValue(java.lang.String defaultValue) throws MaltChainedException
Option
setDefaultValue
in class Option
defaultValue
- the string default valueOptionException
MaltChainedException
public void addLegalValue(java.lang.String value, java.lang.String desc) throws MaltChainedException
value
- a legal value namedesc
- a short description of the legal valueOptionException
MaltChainedException
public void addLegalValue(java.lang.String value) throws MaltChainedException
value
- a legal value nameOptionException
MaltChainedException
public java.lang.String getStringRepresentation(java.lang.Object value)
Option
getStringRepresentation
in class Option
value
- an option value objectCopyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.