| edu.rice.cs.drjava.config.Option
Option | abstract public class Option extends OptionParser implements FormatStrategy<T>(Code) | | An instance of this class represents a configurable option in DrJava that has static type T. Classes can extend
this class and the rest of the Configuration typing framework will work for it. Named subclasses aren't even
necessary -- but may be convenient in order to re-use code. For example, to make an anonymous class that handles
options of static type Integer, with the name "indent.level", you could use the following code:
Option<Integer> INDENT_LEVEL = new Option<Integer>("indent.level") {
public Integer parse(String s) {
return new Integer(s);
}
};
The precedinjg example is simple because Integers (like most data-type classes defined in the Java
libraries) have handy toString() / parsing methods/constructors.
version: $Id: Option.java 4255 2007-08-28 19:17:37Z mgricken $ |
Constructor Summary | |
public | Option(String name, T def) Constructor that takes in a name and default value
Parameters: name - the name of this option (eg. |
Option | public Option(String name, T def)(Code) | | Constructor that takes in a name and default value
Parameters: name - the name of this option (eg. "indent.level"); Parameters: def - the default value for this option (eg. "2") |
format | public String format(T value)(Code) | | Formats a statically typed T value to a String. Since T is an Object, the default implementation uses the
toString() method.
Parameters: value - the statically-typed value to format into a String {@link NullPointerException} if value is null |
getString | String getString(DefaultOptionMap om)(Code) | | Uses format() and getOption() so that any changes in format will automatically be applied to getString().
|
notifyListeners | void notifyListeners(Configuration config, T val)(Code) | | Sends an OptionEvent to all OptionListeners who have registered on this Option.
|
|
|