public class EnumOption extends Option
Enumerations are case sensitive.
| Modifier and Type | Field and Description |
|---|---|
protected int |
defaultValue |
protected int |
value |
protected String[] |
values |
ADDRESS_OPTION, BOOLEAN_OPTION, ENUM_OPTION, FLOAT_OPTION, INT_OPTION, MICROSECONDS_OPTION, PAGES_OPTION, RAW, READABLE, set, STRING_OPTION, XML| Modifier | Constructor and Description |
|---|---|
protected |
EnumOption(OptionSet set,
String name,
String description,
String[] values,
String defaultValue)
Create a new enumeration option.
|
| Modifier and Type | Method and Description |
|---|---|
private int |
findValue(String string)
Searches for a string in the enumeration.
|
int |
getDefaultValue()
Read the default value of the option.
|
String |
getDefaultValueString()
Read the string for the default value of the option.
|
int |
getValue()
Read the current value of the option.
|
String[] |
getValues()
Return the array of allowed enumeration values.
|
String |
getValueString()
Read the string for the current value of the option.
|
void |
setDefaultValue(String value)
Modify the default value of the option.
|
void |
setValue(int value)
Update the value of the option, echoing the change if the echoOptions
option is set.
|
void |
setValue(String value)
Look up the value for a string and update the value of the option
accordingly, echoing the change if the echoOptions option is set.
|
protected int defaultValue
protected int value
protected EnumOption(OptionSet set, String name, String description, String[] values, String defaultValue)
set - The option set this option belongs to.name - The space separated name for the option.description - The purpose of the option.values - A mapping of int to string for the enum.defaultValue - The default value of the option.private int findValue(String string)
string - the string to search forpublic int getValue()
public String getValueString()
public int getDefaultValue()
public String getDefaultValueString()
public void setValue(int value)
value - The new value for the option.public void setValue(String value)
value - The new value for the option.public void setDefaultValue(String value)
value - The new default value for the option.