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.


Constructor Index

 o ConvenientStringMapStd()

Method Index

 o getBoolean(String)
Returns the boolean value for the key.
 o getDouble(String)
Returns the double value for the key.
 o getDoubleDefault(String, double)
Same as getDouble(key) except allows a default to be returned rather than an exception if not found.
 o getFloat(String)
Returns the float value for the key.
 o getFloatDefault(String, float)
Same as getFloat(key) except allows a default to be returned rather than an exception if not found.
 o getInt(String)
Returns the int value for the key.
 o getIntDefault(String, int)
Same as getInt(key) except allows a default to be returned rather than an exception if not found.
 o getLong(String)
Returns the long value for the key.
 o getLongDefault(String, long)
Same as getLong(key) except allows a default to be returned rather than an exception if not found.
 o getString(String)
Returns the String value for the key.
 o getStringDefault(String, String)
Same as getString(key) except allows a default to be returned rather than null.
 o isFalse(String)
Used to determine if the key value is false.
 o isFalseDefault(String, boolean)
Same as isFalse(key) except allows a default to be returned if not found rather than an exception.
 o isTrue(String)
Used to determine if the key value is true.
 o isTrueDefault(String, boolean)
Same as isTrue(key) except allows a default to be returned if not found rather than an exception.
 o setBoolean(String, boolean)
Sets the key value, overwriting any that already exists.
 o setDouble(String, double)
Sets the key value, overwriting any that already exists.
 o setFalse(String)
Same as setBoolean(key, false).
 o setFloat(String, float)
Sets the key value, overwriting any that already exists.
 o setInt(String, int)
Sets the key value, overwriting any that already exists.
 o setLong(String, long)
Sets the key value, overwriting any that already exists.
 o setString(String, String)
Sets the key value, overwriting any that already exists.
 o setTrue(String)
Same as setBoolean(key, true).

Constructors

 o ConvenientStringMapStd
 public ConvenientStringMapStd()

Methods

 o 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.
 o 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.
 o 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.
 o 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.
 o setTrue
 public void setTrue(String key)
Same as setBoolean(key, true).

 o setFalse
 public void setFalse(String key)
Same as setBoolean(key, false).

 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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