.
name
public final String name
- The logical name of this configurable option (i.e. "indent.size") public because it's final,
and a String is immutable.
defaultValue
protected final T defaultValue
map
final HashMap<DefaultOptionMap,T> map
- An inner hashtable that maps DefaultOptionMaps to value T's. Part of the magic inner workings of this package.
OptionParser
public OptionParser(String name,
T def)
- Constructor that takes in a name
- Parameters:
name - the name of this option (i.e. "indent.level");def - default value
getName
public String getName()
- Accessor for name option
- Returns:
- name of this option (i.e. "indent.level")
getDefault
public T getDefault()
- Returns:
- the default value
getDefaultString
public abstract String getDefaultString()
- Returns:
- the default value as a string
parse
public abstract T parse(String value)
- The ability to parse a string to an object of type T. All concrete versions of this class must override this
method to provide some sort of parser implementation.
- Specified by:
parse in interface ParseStrategy<T>
- Parameters:
value - a String to parse
- Returns:
- the statically-typed representation of the string value.
toString
public String toString()
- Returns a string representation of this OptionParser/Option suitable for debugging.
- Overrides:
toString in class Object
getString
abstract String getString(DefaultOptionMap om)
setString
T setString(DefaultOptionMap om,
String val)
- Uses parse() and setOption() so that any changes in parsing will automatically be applied to setString().
getOption
T getOption(DefaultOptionMap om)
- The accessor for the magic-typed hashtable stunt.
setOption
T setOption(DefaultOptionMap om,
T val)
- The mutator for the magic-typed hashtable stunt.
- Returns:
- the previous value associated with key, or null if there was no mapping for key.
(A null return can also indicate that the map previously associated null with key.)
remove
T remove(DefaultOptionMap om)
- The destructor for a mapping in the magic-typed hashtable.