public class ClassOption extends Option
Constructor and Description |
---|
ClassOption(OptionGroup group,
String name,
String shortDescription,
String flag,
String usage)
Creates a class type option description
|
Modifier and Type | Method and Description |
---|---|
void |
addLegalValue(String value,
String desc,
String classname)
Adds a legal value that corresponds to a class
|
Class<?> |
getClazz(String value)
Returns the class that corresponds to the enumerate string value.
|
Object |
getDefaultValueObject()
Returns the object for the default value for option.
|
String |
getDefaultValueString()
Returns a string representation of the default value.
|
String |
getLegalValueString(Class<?> clazz)
Returns a string representation of particular class
|
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 ClassOption(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 OptionException
Option
getDefaultValueObject
in class Option
OptionException
public String getLegalValueString(Class<?> clazz) throws MaltChainedException
clazz
- an class objectMaltChainedException
public void setDefaultValue(String defaultValue) throws MaltChainedException
Option
setDefaultValue
in class Option
defaultValue
- the string default valueOptionException
MaltChainedException
public Class<?> getClazz(String value)
value
- an enumerate string valuepublic void addLegalValue(String value, String desc, String classname) throws MaltChainedException
value
- a legal value namedesc
- a short description of the legal valueclassname
- the fully qualified name of the classOptionException
MaltChainedException
public String getDefaultValueString()
Option
getDefaultValueString
in class Option
public String getStringRepresentation(Object value)
Option
getStringRepresentation
in class Option
value
- an option value objectCopyright 2007-2014 Johan Hall, Jens Nilsson and Joakim Nivre.