|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.aludratest.config.ValidatingPreferencesWrapper
public final class ValidatingPreferencesWrapper
Helper class for Preferences consumers which can be used to have getter methods which validate the existence of a configuration
property when trying to retrieve it. Clients can wrap an existing Preferences object with this class and use its methods.
Queried child nodes are automatically wrapped and returned as ValidatingPreferencesWrapper.
Constructor Summary | |
---|---|
ValidatingPreferencesWrapper(Preferences delegate)
Creates a new ValidatingPreferencesWrapper object which wraps the given Preferences object. |
Method Summary | |
---|---|
boolean |
getBooleanValue(String key)
Returns the boolean representation of the given configuration key's value. |
boolean |
getBooleanValue(String key,
boolean defaultValue)
Returns the boolean representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored String form of the value is null . |
char |
getCharValue(String key)
Returns the char representation of the given configuration key's value. |
char |
getCharValue(String key,
char defaultValue)
Returns the char representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored String form of the value is null . |
ValidatingPreferencesWrapper |
getChildNode(String name)
Returns the configuration child node with the given name, or null if no such node exists on this configuration
node. |
String[] |
getChildNodeNames()
Returns the names of the available configuration child nodes on this configuration node. |
double |
getDoubleValue(String key)
Returns the double representation of the given configuration key's value. |
double |
getDoubleValue(String key,
double defaultValue)
Returns the double representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored String form of the value is null . |
float |
getFloatValue(String key)
Returns the float representation of the given configuration key's value. |
float |
getFloatValue(String key,
float defaultValue)
Returns the float representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored String form of the value is null . |
int |
getIntValue(String key)
Returns the int representation of the given configuration key's value. |
int |
getIntValue(String key,
int defaultValue)
Returns the int representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored String form of the value is null . |
String[] |
getKeyNames()
Returns the available configuration key names on this Preferences node. |
boolean |
getRequiredBooleanValue(String key)
Returns the boolean representation of the given configuration key's value. |
char |
getRequiredCharValue(String key)
Returns the char representation of the given configuration key's value. |
double |
getRequiredDoubleValue(String key)
Returns the double representation of the given configuration key's value. |
float |
getRequiredFloatValue(String key)
Returns the float representation of the given configuration key's value. |
int |
getRequiredIntValue(String key)
Returns the int representation of the given configuration key's value. |
String |
getRequiredStringValue(String key)
Returns the String representation of the given configuration key's value. |
String |
getStringValue(String key)
Returns the String representation of the given configuration key's value. |
String |
getStringValue(String key,
String defaultValue)
Returns the String representation of the given configuration key's value, or the given default value when no value is stored for this key, or the stored value is null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidatingPreferencesWrapper(Preferences delegate)
delegate
- Preferences node to wrap.Method Detail |
---|
public String getRequiredStringValue(String key)
null
, an AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public int getRequiredIntValue(String key)
null
, an
AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public double getRequiredDoubleValue(String key)
null
, an
AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public float getRequiredFloatValue(String key)
null
, an
AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public boolean getRequiredBooleanValue(String key)
null
, an
AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public char getRequiredCharValue(String key)
null
, an
AutomationException
is thrown.
key
- Configuration key to retrieve the value of.
public String getStringValue(String key)
Preferences
getStringValue
in interface Preferences
key
- Configuration key to retrieve the value of.
null
is returned if no value is stored.public int getIntValue(String key)
Preferences
getIntValue
in interface Preferences
key
- Configuration key to retrieve the value of.
0
is returned if no value is stored, or the stored
String is null
.public boolean getBooleanValue(String key)
Preferences
getBooleanValue
in interface Preferences
key
- Configuration key to retrieve the value of.
false
is returned if no value is stored, or the
stored String is null
.public float getFloatValue(String key)
Preferences
getFloatValue
in interface Preferences
key
- Configuration key to retrieve the value of.
0
is returned if no value is stored, or the stored
String is null
.public double getDoubleValue(String key)
Preferences
getDoubleValue
in interface Preferences
key
- Configuration key to retrieve the value of.
0
is returned if no value is stored, or the stored
String is null
.public char getCharValue(String key)
Preferences
getCharValue
in interface Preferences
key
- Configuration key to retrieve the value of.
'\0'
is returned if no value is stored, or the stored
String is null
. If a longer String is stored, only the first character is returned.public String getStringValue(String key, String defaultValue)
Preferences
null
.
getStringValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or the stored value is
null
.
public int getIntValue(String key, int defaultValue)
Preferences
null
.
getIntValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or if the stored String form
of the value is null
.
public boolean getBooleanValue(String key, boolean defaultValue)
Preferences
null
.
getBooleanValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or if the stored String form
of the value is null
.
public float getFloatValue(String key, float defaultValue)
Preferences
null
.
getFloatValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or if the stored String form
of the value is null
.
public double getDoubleValue(String key, double defaultValue)
Preferences
null
.
getDoubleValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or if the stored String form
of the value is null
.
public char getCharValue(String key, char defaultValue)
Preferences
null
.
getCharValue
in interface Preferences
key
- Configuration key to retrieve the value of.defaultValue
- The default value to return if no value is stored for the given configuration key, or if the stored String form
of the value is null
.
public String[] getKeyNames()
Preferences
getKeyNames
in interface Preferences
null
.public ValidatingPreferencesWrapper getChildNode(String name)
Preferences
null
if no such node exists on this configuration
node.
getChildNode
in interface Preferences
name
- Name of the configuration child node
null
if no such node exists on this configuration
node.public String[] getChildNodeNames()
Preferences
getChildNodeNames
in interface Preferences
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |