All Packages Class Hierarchy This Package Previous Next Index
Class uhr.core.tron.ConvenientStringMapStd
java.lang.Object
|
+----uhr.core.tron.ConvenientStringMapStd
- public abstract class ConvenientStringMapStd
- extends Object
- implements ConvenientStringMap, Cloneable
This is an abstract class implementing ConvenientStringMap
for data structure classes to subclass. The use of the
Template Method pattern allows the subclasses to offer the full
ease-of-use features ConvenientStringMap offers without the
drudgery, bulk and lower reuse of an implementation.
-
ConvenientStringMapStd()
-
-
getBoolean(String)
- Returns the boolean value for the key.
-
getDouble(String)
- Returns the double value for the key.
-
getDoubleDefault(String, double)
- Same as getDouble(key) except allows a default to be
returned rather than an exception if not found.
-
getFloat(String)
- Returns the float value for the key.
-
getFloatDefault(String, float)
- Same as getFloat(key) except allows a default to be
returned rather than an exception if not found.
-
getInt(String)
- Returns the int value for the key.
-
getIntDefault(String, int)
- Same as getInt(key) except allows a default to be
returned rather than an exception if not found.
-
getLong(String)
- Returns the long value for the key.
-
getLongDefault(String, long)
- Same as getLong(key) except allows a default to be
returned rather than an exception if not found.
-
getString(String)
- Returns the String value for the key.
-
getStringDefault(String, String)
- Same as getString(key) except allows a default to be
returned rather than null.
-
isFalse(String)
- Used to determine if the key value is false.
-
isFalseDefault(String, boolean)
- Same as isFalse(key) except allows a default to be
returned if not found rather than an exception.
-
isTrue(String)
- Used to determine if the key value is true.
-
isTrueDefault(String, boolean)
- Same as isTrue(key) except allows a default to be
returned if not found rather than an exception.
-
setBoolean(String, boolean)
- Sets the key value, overwriting any that already exists.
-
setDouble(String, double)
- Sets the key value, overwriting any that already exists.
-
setFalse(String)
- Same as setBoolean(key, false).
-
setFloat(String, float)
- Sets the key value, overwriting any that already exists.
-
setInt(String, int)
- Sets the key value, overwriting any that already exists.
-
setLong(String, long)
- Sets the key value, overwriting any that already exists.
-
setString(String, String)
- Sets the key value, overwriting any that already exists.
-
setTrue(String)
- Same as setBoolean(key, true).
ConvenientStringMapStd
public ConvenientStringMapStd()
setString
public void setString(String key,
String value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the String value, which may be null.
getString
public String getString(String key)
- Returns the String value for the key.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or null.
getStringDefault
public String getStringDefault(String key,
String defaultValue)
- Same as getString(key) except allows a default to be
returned rather than null.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if the
return would otherwise be null.
- Returns:
- the key's value or the defaultValue if not found.
setBoolean
public void setBoolean(String key,
boolean value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the boolean value.
setTrue
public void setTrue(String key)
- Same as setBoolean(key, true).
setFalse
public void setFalse(String key)
- Same as setBoolean(key, false).
getBoolean
public boolean getBoolean(String key)
- Returns the boolean value for the key.
We assume that the setBoolean method was used to set this value.
If a non-Boolean value is found, an IllegalStateException is thrown.
If no value is set, an IllegalStateException is thrown.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or an exception if not found.
isTrue
public boolean isTrue(String key)
- Used to determine if the key value is true.
- Parameters:
- key - the key in question.
- Returns:
- true if the key's value is true, false if
it's false, or an exception if not found.
isTrueDefault
public boolean isTrueDefault(String key,
boolean defaultValue)
- Same as isTrue(key) except allows a default to be
returned if not found rather than an exception.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if the
value is not found.
- Returns:
- true if the key's value is true, false if
it's false, or the defaultValue if not found.
isFalse
public boolean isFalse(String key)
- Used to determine if the key value is false.
- Parameters:
- key - the key in question.
- Returns:
- true if the key's value is false, false if
it's true, or an exception if not found.
isFalseDefault
public boolean isFalseDefault(String key,
boolean defaultValue)
- Same as isFalse(key) except allows a default to be
returned if not found rather than an exception.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if the
value is not found.
- Returns:
- true if the key's value is false, false if
it's true, or the defaultValue if not found.
setInt
public void setInt(String key,
int value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the int value.
getInt
public int getInt(String key)
- Returns the int value for the key.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or an exception if not found.
getIntDefault
public int getIntDefault(String key,
int defaultValue)
- Same as getInt(key) except allows a default to be
returned rather than an exception if not found.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if not found.
- Returns:
- the key's value or the defaultValue if not found.
setLong
public void setLong(String key,
long value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the long value.
getLong
public long getLong(String key)
- Returns the long value for the key.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or an exception if not found.
getLongDefault
public long getLongDefault(String key,
long defaultValue)
- Same as getLong(key) except allows a default to be
returned rather than an exception if not found.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if not found.
- Returns:
- the key's value or the defaultValue if not found.
setFloat
public void setFloat(String key,
float value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the float value.
getFloat
public float getFloat(String key)
- Returns the float value for the key.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or an exception if not found.
getFloatDefault
public float getFloatDefault(String key,
float defaultValue)
- Same as getFloat(key) except allows a default to be
returned rather than an exception if not found.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if not found.
- Returns:
- the key's value or the defaultValue if not found.
setDouble
public void setDouble(String key,
double value)
- Sets the key value, overwriting any that already exists.
- Parameters:
- key - the unique key, which may not be null.
- value - the double value.
getDouble
public double getDouble(String key)
- Returns the double value for the key.
- Parameters:
- key - the key to be used for the lookup.
- Returns:
- the key's value or an exception if not found.
getDoubleDefault
public double getDoubleDefault(String key,
double defaultValue)
- Same as getDouble(key) except allows a default to be
returned rather than an exception if not found.
- Parameters:
- key - the key to be used for the lookup.
- defaultValue - the default to be used if not found.
- Returns:
- the key's value or the defaultValue if not found.
All Packages Class Hierarchy This Package Previous Next Index