public class StringEnumOption extends Option
Constructor and Description |
---|
StringEnumOption(OptionGroup group,
String name,
String shortDescription,
String flag,
String usage)
Creates a stringenum type option description
|
Modifier and Type | Method and Description |
---|---|
void |
addLegalValue(String value,
String desc,
String mapto)
Adds a legal value that corresponds to another string
|
Object |
getDefaultValueObject()
Returns the object for the default value for option.
|
String |
getDefaultValueString()
Returns a string representation of the default value.
|
String |
getLegalValueMapToString(String value)
Returns the mapped legal value
|
String |
getLegalValueString(String value)
Returns the legal value identifier name (an enumerate string value)
|
String |
getMapto(String value)
Returns the mapped legal value that corresponds to the enumerate string value.
|
String |
getStringRepresentation(Object value)
Returns a string representation of the option value.
|
Object |
getValueObject(String value)
Returns the corresponding object for the option value (specified as a string value).
|
void |
setDefaultValue(String defaultValue)
Sets the default value for the option.
|
String |
toString() |
compareTo, getFlag, getGroup, getName, getShortDescription, getUsage, isAmbiguous, setAmbiguous, setFlag, setUsage, setUsage
public StringEnumOption(OptionGroup group, String name, String shortDescription, String flag, 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 Object getValueObject(String value) throws MaltChainedException
Option
getValueObject
in class Option
value
- the string option valueOptionException
MaltChainedException
public Object getDefaultValueObject() throws MaltChainedException
Option
getDefaultValueObject
in class Option
OptionException
MaltChainedException
public String getLegalValueString(String value) throws MaltChainedException
value
- the mapped legal valueMaltChainedException
public String getLegalValueMapToString(String value) throws MaltChainedException
value
- an enumerate string valueMaltChainedException
public void setDefaultValue(String defaultValue) throws MaltChainedException
Option
setDefaultValue
in class Option
defaultValue
- the string default valueOptionException
MaltChainedException
public String getDefaultValueString()
Option
getDefaultValueString
in class Option
public String getMapto(String value)
value
- an enumerate string valuepublic void addLegalValue(String value, String desc, String mapto) throws MaltChainedException
value
- a legal value namedesc
- a short description of the legal valuemapto
- a mapto string valueOptionException
MaltChainedException
public String getStringRepresentation(Object value)
Option
getStringRepresentation
in class Option
value
- an option value objectCopyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.