|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Configuration interface. The general idea here is to make something that will work like our extended properties and be compatible with the preferences API if at all possible.
Method Summary | |
void |
addProperty(java.lang.String key,
java.lang.Object value)
Add a property to the configuration. |
void |
clearProperty(java.lang.String key)
Clear a property in the configuration. |
boolean |
containsKey(java.lang.String key)
Check if the configuration contains the key. |
boolean |
getBoolean(java.lang.String key)
Get a boolean associated with the given configuration key. |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Get a boolean associated with the given configuration key. |
java.lang.Boolean |
getBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
Get a boolean associated with the given configuration key. |
byte |
getByte(java.lang.String key)
Get a byte associated with the given configuration key. |
byte |
getByte(java.lang.String key,
byte defaultValue)
Get a byte associated with the given configuration key. |
java.lang.Byte |
getByte(java.lang.String key,
java.lang.Byte defaultValue)
Get a byte associated with the given configuration key. |
double |
getDouble(java.lang.String key)
Get a double associated with the given configuration key. |
double |
getDouble(java.lang.String key,
double defaultValue)
Get a double associated with the given configuration key. |
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double defaultValue)
Get a double associated with the given configuration key. |
float |
getFloat(java.lang.String key)
Get a float associated with the given configuration key. |
float |
getFloat(java.lang.String key,
float defaultValue)
Get a float associated with the given configuration key. |
java.lang.Float |
getFloat(java.lang.String key,
java.lang.Float defaultValue)
Get a float associated with the given configuration key. |
int |
getInt(java.lang.String key)
Get a int associated with the given configuration key. |
int |
getInt(java.lang.String key,
int defaultValue)
Get a int associated with the given configuration key. |
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer defaultValue)
Get a int associated with the given configuration key. |
java.util.Iterator |
getKeys()
Get the list of the keys contained in the configuration repository. |
java.util.Iterator |
getKeys(java.lang.String prefix)
Get the list of the keys contained in the configuration repository that match the specified prefix. |
java.util.List |
getList(java.lang.String key)
Get a List of strings associated with the given configuration key. |
java.util.List |
getList(java.lang.String key,
java.util.List defaultValue)
Get a List of strings associated with the given configuration key. |
long |
getLong(java.lang.String key)
Get a long associated with the given configuration key. |
long |
getLong(java.lang.String key,
long defaultValue)
Get a long associated with the given configuration key. |
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long defaultValue)
Get a long associated with the given configuration key. |
java.util.Properties |
getProperties(java.lang.String key)
Get a list of properties associated with the given configuration key. |
java.lang.Object |
getProperty(java.lang.String key)
Gets a property from the configuration. |
short |
getShort(java.lang.String key)
Get a short associated with the given configuration key. |
short |
getShort(java.lang.String key,
short defaultValue)
Get a short associated with the given configuration key. |
java.lang.Short |
getShort(java.lang.String key,
java.lang.Short defaultValue)
Get a short associated with the given configuration key. |
java.lang.String |
getString(java.lang.String key)
Get a string associated with the given configuration key. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Get a string associated with the given configuration key. |
java.lang.String[] |
getStringArray(java.lang.String key)
Get an array of strings associated with the given configuration key. |
boolean |
isEmpty()
Check if the configuration is empty. |
void |
setProperty(java.lang.String key,
java.lang.Object value)
Set a property, this will replace any previously set values. |
Configuration |
subset(java.lang.String prefix)
Create an Configuration object that is a subset of this one. |
Method Detail |
public Configuration subset(java.lang.String prefix)
prefix
- The prefix used to select the properties.public boolean isEmpty()
public boolean containsKey(java.lang.String key)
public void addProperty(java.lang.String key, java.lang.Object value)
key
- The Key to add the property to.public void setProperty(java.lang.String key, java.lang.Object value)
key
- The key of the property to changevalue
- The new valuepublic void clearProperty(java.lang.String key)
key
- the key to remove along with corresponding value.public java.lang.Object getProperty(java.lang.String key)
key
- property to retrieve
public java.util.Iterator getKeys(java.lang.String prefix)
prefix
- The prefix to test against.
public java.util.Iterator getKeys()
public java.util.Properties getProperties(java.lang.String key)
key
- The configuration key.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a String/List.
java.lang.IllegalArgumentException
- if one of the tokens is
malformed (does not contain an equals sign).public boolean getBoolean(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Boolean.public boolean getBoolean(java.lang.String key, boolean defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Boolean.public java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Boolean.public byte getByte(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Byte.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public byte getByte(java.lang.String key, byte defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Byte.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an object that
is not a Byte.
java.lang.NumberFormatException
- is thrown if the value mapped by the key
has not a valid number format.public double getDouble(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Double.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public double getDouble(java.lang.String key, double defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Double.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Double.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public float getFloat(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Float.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public float getFloat(java.lang.String key, float defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Float.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Float.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public int getInt(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Integer.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public int getInt(java.lang.String key, int defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Integer.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an object that
is not a Integer.
java.lang.NumberFormatException
- is thrown if the value mapped by the key
has not a valid number format.public long getLong(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Long.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public long getLong(java.lang.String key, long defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Long.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Long.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public short getShort(java.lang.String key)
key
- The configuration key.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Short.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public short getShort(java.lang.String key, short defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Short.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.public java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a Short.
java.lang.NumberFormatException
- is thrown if the value mapped
by the key has not a valid number format.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.public java.lang.String getString(java.lang.String key)
key
- The configuration key.
java.lang.ClassCastException
- is thrown if the key maps to an object that
is not a String.
NoSuchElementException
- is thrown if the key doesn't
map to an existing object.public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an object that
is not a String.public java.lang.String[] getStringArray(java.lang.String key)
key
- The configuration key.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a String/List of Strings.public java.util.List getList(java.lang.String key)
key
- The configuration key.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a List.public java.util.List getList(java.lang.String key, java.util.List defaultValue)
key
- The configuration key.defaultValue
- The default value.
java.lang.ClassCastException
- is thrown if the key maps to an
object that is not a List.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |