|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcckit.util.ConfigParameters
Read-only class for hierarchically organized key-value pairs. The key is always a string. The following value types are supported:
In accordance with the Strategy design pattern the retrieval of
a key-value pair is delegated to an instance of
ConfigData
.
Constructor Summary | |
ConfigParameters(ConfigData configData)
Creates an instance from the specified ConfigData object. |
Method Summary | |
java.lang.String |
get(java.lang.String key)
Returns the string value associated with the specified key. |
java.lang.String |
get(java.lang.String key,
java.lang.String defaultValue)
Returns the string value associated with the specified key or defaultValue if undefined. |
boolean |
getBoolean(java.lang.String key)
Returns the boolean associated with the specified key. |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Returns the boolean associated with the specified key. |
java.awt.Color |
getColor(java.lang.String key)
Returns the color associated with the specified key. |
java.awt.Color |
getColor(java.lang.String key,
java.awt.Color defaultValue)
Returns the color associated with the specified key or the specified default value if no key-value pair exists for the specified key. |
double |
getDouble(java.lang.String key)
Returns the double associated with the specified key. |
double |
getDouble(java.lang.String key,
double defaultValue)
Returns the double associated with the specified key or defaultValue if no key-value pair exists for the specified key. |
double[] |
getDoubleArray(java.lang.String key)
Returns the array of doubles associated with the specified key. |
double[] |
getDoubleArray(java.lang.String key,
double[] defaultValue)
Returns the array of doubles associated with the specified key or defaultValue if no key-value pair exists for the specified key. |
java.lang.String |
getFullKey(java.lang.String key)
Returns the full key. |
int |
getInt(java.lang.String key)
Returns the integer associated with the specified key. |
int |
getInt(java.lang.String key,
int defaultValue)
Returns the integer associated with the specified key or defaultValue if no key-value pair exists for the specified key. |
ConfigParameters |
getNode(java.lang.String key)
Returns the child node associated with the specified key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConfigParameters(ConfigData configData)
Method Detail |
public java.lang.String getFullKey(java.lang.String key)
ConfigData.getFullKey(java.lang.String)
public java.lang.String get(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.IllegalArgumentException
- if no value exists for key.
The exception message is the full key.public java.lang.String get(java.lang.String key, java.lang.String defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
public boolean getBoolean(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.IllegalArgumentException
- if no value exists for key.
The exception message is the full key.
java.lang.NumberFormatException
- if the value is neither "true" nor "false".public boolean getBoolean(java.lang.String key, boolean defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
java.lang.NumberFormatException
- if the value is neither "true" nor "false".public int getInt(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.IllegalArgumentException
- if no value exists for key.
The exception message is the full key.
java.lang.NumberFormatException
- if the value is not a number.
The exception message contains the full key and the invalid value.public int getInt(java.lang.String key, int defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
java.lang.NumberFormatException
- if the value exists but is not a number.
The exception message contains the full key and the invalid value.public double getDouble(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.IllegalArgumentException
- if no value exists for key.
The exception message is the full key.
java.lang.NumberFormatException
- if the value is not a valid number.
The exception message contains the full key and the invalid value.public double getDouble(java.lang.String key, double defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
java.lang.NumberFormatException
- if the value exists but is not a valid
number.
The exception message contains the full key and the invalid value.public double[] getDoubleArray(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.IllegalArgumentException
- if no value exists for key.
The exception message is the full key.
java.lang.NumberFormatException
- if the value exists but is not a
sequence of number. The exception message contains
the full key and the invalid value.public double[] getDoubleArray(java.lang.String key, double[] defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
java.lang.NumberFormatException
- if the value exists but is not a
sequence of number. The exception message contains
the full key and the invalid value.public java.awt.Color getColor(java.lang.String key)
key
- The (relative) key. null is not allowed.
java.lang.NumberFormatException
- if the value exists but is not a number.
The exception message contains the full key and the invalid value.public java.awt.Color getColor(java.lang.String key, java.awt.Color defaultValue)
key
- The (relative) key. null is not allowed.defaultValue
- The default value. Can be null.
java.lang.NumberFormatException
- if the value exists but is not a number.
The exception message contains the full key and the invalid value.public ConfigParameters getNode(java.lang.String key)
key
- The (relative) key. null is not allowed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |