|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.drjava.config.OptionParser<T>
edu.rice.cs.drjava.config.Option<String>
edu.rice.cs.drjava.config.ForcedChoiceOption
public class ForcedChoiceOption
Class defining a configuration option that requires a choice between mutually-exclusive possible values. Values are stored as Strings, though this could be extended to any type with a fairly simple refactoring.
Field Summary |
---|
Fields inherited from class edu.rice.cs.drjava.config.OptionParser |
---|
defaultValue, name |
Constructor Summary | |
---|---|
ForcedChoiceOption(String key,
String def,
Collection<String> choices)
|
Method Summary | |
---|---|
String |
format(String s)
Formats a statically typed T value as a String. |
Iterator<String> |
getLegalValues()
Gets all legal values of this option. |
int |
getNumValues()
Gets the number of legal values for this option. |
boolean |
isLegal(String s)
Checks whether the parameter String is a legal value for this option. |
String |
parse(String s)
Parses an arbitrary String into an acceptable value for this option. |
Methods inherited from class edu.rice.cs.drjava.config.Option |
---|
getDefaultString |
Methods inherited from class edu.rice.cs.drjava.config.OptionParser |
---|
getDefault, getName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ForcedChoiceOption(String key, String def, Collection<String> choices)
key
- The name of this option.def
- The default value of the option.choices
- A collection of all possible values of this Option, as Strings.Method Detail |
---|
public boolean isLegal(String s)
s
- the value to check
public Iterator<String> getLegalValues()
public int getNumValues()
public String parse(String s)
parse
in interface ParseStrategy<String>
parse
in class OptionParser<String>
s
- The String to be parsed.
IllegalArgumentException
- if "s" is not one of the allowed values.public String format(String s)
Option
format
in interface FormatStrategy<String>
format
in class Option<String>
s
- The String to be formatted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |