|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.vmutil.options.Option org.vmutil.options.EnumOption
public class EnumOption
An option that is a selection of several strings. The mapping between strings and integers is determined using indexes into a string array.
Enumerations are case sensitive.
Field Summary | |
---|---|
protected int |
defaultValue
|
protected int |
value
|
protected String[] |
values
|
Fields inherited from class org.vmutil.options.Option |
---|
ADDRESS_OPTION, BOOLEAN_OPTION, ENUM_OPTION, FLOAT_OPTION, INT_OPTION, MICROSECONDS_OPTION, PAGES_OPTION, RAW, READABLE, set, STRING_OPTION, XML |
Constructor Summary | |
---|---|
protected |
EnumOption(OptionSet set,
String name,
String description,
String[] values,
String defaultValue)
Create a new enumeration option. |
Method Summary | |
---|---|
private int |
findValue(String string)
Search 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. |
Methods inherited from class org.vmutil.options.Option |
---|
fail, failIf, getDescription, getKey, getName, getNext, getType, setNext, validate, warn, warnIf |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int defaultValue
protected int value
protected String[] values
Constructor Detail |
---|
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.Method Detail |
---|
private int findValue(String string)
public 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.public String[] getValues()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |