|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.germinus.easyconf.ComponentProperties
Part of a component configuration which contains its properties.
The properties can be accessed by type and automatic conversion will be
performed. The supported types are: BigDecimal, BigInteger, Boolean, Byte,
Double, Float, Integer, List, Long, Short, String and StringArray
It is based on the Configuration
interface from Jakarta
Commons Configuration but it is given a different name which makes more sense
inside EasyConf.
The boolean flag throwExceptionOnMissing controls the behaviour of this class
when a property that does not exist is queried. If set to true (the default)
a NoSuchElementException will be thrown if the given key does not
exist and no default was provided. If set to false, null will be
returned except for the method getList() which will return an empty
unmodifyiable list.
Field Summary | |
static java.lang.String |
NULL_STRING
|
Method Summary | |
boolean |
containsKey(java.lang.String key)
|
boolean |
equals(java.lang.Object obj)
|
java.math.BigDecimal |
getBigDecimal(java.lang.String key)
|
java.math.BigDecimal |
getBigDecimal(java.lang.String key,
java.math.BigDecimal defaultValue)
|
java.math.BigDecimal |
getBigDecimal(java.lang.String key,
Filter filter)
|
java.math.BigDecimal |
getBigDecimal(java.lang.String key,
Filter filter,
java.math.BigDecimal defaultValue)
|
java.math.BigInteger |
getBigInteger(java.lang.String key)
|
java.math.BigInteger |
getBigInteger(java.lang.String key,
java.math.BigInteger defaultValue)
|
java.math.BigInteger |
getBigInteger(java.lang.String key,
Filter filter)
|
java.math.BigInteger |
getBigInteger(java.lang.String key,
Filter filter,
java.math.BigInteger defaultValue)
|
boolean |
getBoolean(java.lang.String key)
|
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
|
java.lang.Boolean |
getBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
|
boolean |
getBoolean(java.lang.String key,
Filter filter)
|
boolean |
getBoolean(java.lang.String key,
Filter filter,
boolean defaultValue)
|
java.lang.Boolean |
getBoolean(java.lang.String key,
Filter filter,
java.lang.Boolean defaultValue)
|
byte |
getByte(java.lang.String key)
|
byte |
getByte(java.lang.String key,
byte defaultValue)
|
java.lang.Byte |
getByte(java.lang.String key,
java.lang.Byte defaultValue)
|
byte |
getByte(java.lang.String key,
Filter filter)
|
byte |
getByte(java.lang.String key,
Filter filter,
byte defaultValue)
|
java.lang.Byte |
getByte(java.lang.String key,
Filter filter,
java.lang.Byte defaultValue)
|
java.lang.Class |
getClass(java.lang.String key)
Get the Class representation of the class name specified
in the given property |
java.lang.Class |
getClass(java.lang.String key,
java.lang.Class defaultValue)
Get the Class representation of the class name specified
in the given property. |
java.lang.Class |
getClass(java.lang.String key,
Filter filter)
Similar to the previous methods but complementing the property key with the given filter |
java.lang.Class |
getClass(java.lang.String key,
Filter filter,
java.lang.Class defaultValue)
Equivalent to the previous method but giving a default value which will be used if no value has been specified in the configurations file |
java.lang.Class[] |
getClassArray(java.lang.String key)
Get an array of Class objects for the class names
specified in the given property |
java.lang.Class[] |
getClassArray(java.lang.String key,
java.lang.Class[] defaultValue)
Get an array of Class objects for the class names
specified in the given property. |
java.lang.Class[] |
getClassArray(java.lang.String key,
Filter filter)
Similar to the previous methods but complementing the property key with the given filter |
java.lang.Class[] |
getClassArray(java.lang.String key,
Filter filter,
java.lang.Class[] defaultValue)
Equivalent to the previous method but giving a default value which will be used if no value has been specified in the configurations file |
java.lang.String |
getComponentName()
|
java.lang.Long |
getDelayPeriod()
Returned the configured delay period for this component or null if reloading is not being performed |
double |
getDouble(java.lang.String key)
|
double |
getDouble(java.lang.String key,
double defaultValue)
|
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double defaultValue)
|
double |
getDouble(java.lang.String key,
Filter filter)
|
double |
getDouble(java.lang.String key,
Filter filter,
double defaultValue)
|
java.lang.Double |
getDouble(java.lang.String key,
Filter filter,
java.lang.Double defaultValue)
|
float |
getFloat(java.lang.String key)
|
float |
getFloat(java.lang.String key,
Filter filter)
|
float |
getFloat(java.lang.String key,
Filter filter,
float defaultValue)
|
java.lang.Float |
getFloat(java.lang.String key,
Filter filter,
java.lang.Float defaultValue)
|
float |
getFloat(java.lang.String key,
float defaultValue)
|
java.lang.Float |
getFloat(java.lang.String key,
java.lang.Float defaultValue)
|
int |
getInt(java.lang.String key)
|
int |
getInt(java.lang.String key,
Filter filter)
|
int |
getInt(java.lang.String key,
Filter filter,
int defaultValue)
|
int |
getInt(java.lang.String key,
int defaultValue)
|
java.lang.Integer |
getInteger(java.lang.String key,
Filter filter,
java.lang.Integer defaultValue)
|
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer defaultValue)
|
java.util.Iterator |
getKeys()
|
java.util.Iterator |
getKeys(java.lang.String prefix)
|
java.util.List |
getList(java.lang.String key)
|
java.util.List |
getList(java.lang.String key,
Filter filter)
|
java.util.List |
getList(java.lang.String key,
Filter filter,
java.util.List defaultValue)
|
java.util.List |
getList(java.lang.String key,
java.util.List defaultValue)
|
java.util.List |
getLoadedSources()
Get a list of the sources which have been loaded for this component |
long |
getLong(java.lang.String key)
|
long |
getLong(java.lang.String key,
Filter filter)
|
long |
getLong(java.lang.String key,
Filter filter,
long defaultValue)
|
java.lang.Long |
getLong(java.lang.String key,
Filter filter,
java.lang.Long defaultValue)
|
long |
getLong(java.lang.String key,
long defaultValue)
|
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long defaultValue)
|
java.util.Properties |
getProperties()
Returns a copy of the configuration into a java.util.Properties class. |
java.lang.Object |
getProperty(java.lang.String key)
|
protected java.lang.Object |
getPropertyWithFilter(java.lang.String key,
Filter filter,
java.lang.Class theClass,
java.lang.Object defaultValue)
|
short |
getShort(java.lang.String key)
|
short |
getShort(java.lang.String key,
Filter filter)
|
short |
getShort(java.lang.String key,
Filter filter,
short defaultValue)
|
java.lang.Short |
getShort(java.lang.String key,
Filter filter,
java.lang.Short defaultValue)
|
short |
getShort(java.lang.String key,
short defaultValue)
|
java.lang.Short |
getShort(java.lang.String key,
java.lang.Short defaultValue)
|
java.lang.String |
getString(java.lang.String key)
Get the String value of the given key. |
java.lang.String |
getString(java.lang.String key,
Filter filter)
|
java.lang.String |
getString(java.lang.String key,
Filter filter,
java.lang.String defaultValue)
|
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
|
java.lang.String[] |
getStringArray(java.lang.String key)
|
java.lang.String[] |
getStringArray(java.lang.String key,
Filter filter)
|
java.lang.String[] |
getStringArray(java.lang.String key,
Filter filter,
java.lang.String[] defaultValue)
|
java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String[] defaultValue)
|
protected static java.lang.Object |
getTypedPropertyWithDefault(java.lang.String key,
java.lang.Class theClass,
org.apache.commons.configuration.Configuration properties,
java.lang.Object defaultValue)
|
boolean |
hasBaseConfiguration()
|
int |
hashCode()
|
boolean |
isEmpty()
|
boolean |
isThrowExceptionOnMissing()
|
protected java.lang.String |
listToString(java.util.List list)
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
|
void |
setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
Set the flag throwExceptionOnMissing. |
org.apache.commons.configuration.Configuration |
subset(java.lang.String prefix)
|
org.apache.commons.configuration.Configuration |
toConfiguration()
Returns a decorator of the configuration of type org.apache.commons.configuration.Configuration Note that any changes made to this decorator will be made to the original configuration and viceversa. |
org.apache.commons.configuration.DataConfiguration |
toDataConfiguration()
Returns a decorator of the configuration of type org.apache.commons.configuration.DataConfiguration. |
org.apache.commons.beanutils.DynaBean |
toDynaBean()
Returns a decorator of the configuration that can be used as a DynaBean. |
java.util.Map |
toMap()
Returns a decorator of the configuration that implements the Map interface. |
java.lang.String |
toString()
|
protected void |
validateValue(java.lang.String key,
java.lang.Object value)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String NULL_STRING
Method Detail |
public java.util.Map toMap()
java.util.Map
instancepublic org.apache.commons.beanutils.DynaBean toDynaBean()
DynaBean
instancepublic org.apache.commons.configuration.Configuration toConfiguration()
Configuration
instancepublic org.apache.commons.configuration.DataConfiguration toDataConfiguration()
DataConfiguration
instancepublic java.util.Properties getProperties()
Properties
instancepublic java.lang.Object getProperty(java.lang.String key)
public boolean containsKey(java.lang.String key)
public boolean equals(java.lang.Object obj)
public java.util.Iterator getKeys()
public java.util.Iterator getKeys(java.lang.String prefix)
public int hashCode()
public boolean isEmpty()
public void setProperty(java.lang.String key, java.lang.Object value)
public org.apache.commons.configuration.Configuration subset(java.lang.String prefix)
public java.lang.String toString()
public java.math.BigDecimal getBigDecimal(java.lang.String key)
public java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal defaultValue)
public java.math.BigDecimal getBigDecimal(java.lang.String key, Filter filter)
public java.math.BigDecimal getBigDecimal(java.lang.String key, Filter filter, java.math.BigDecimal defaultValue)
public java.math.BigInteger getBigInteger(java.lang.String key)
public java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger defaultValue)
public java.math.BigInteger getBigInteger(java.lang.String key, Filter filter)
public java.math.BigInteger getBigInteger(java.lang.String key, Filter filter, java.math.BigInteger defaultValue)
public boolean getBoolean(java.lang.String key)
public boolean getBoolean(java.lang.String key, boolean defaultValue)
public java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultValue) throws java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError
public boolean getBoolean(java.lang.String key, Filter filter)
public java.lang.Boolean getBoolean(java.lang.String key, Filter filter, java.lang.Boolean defaultValue) throws java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError
public boolean getBoolean(java.lang.String key, Filter filter, boolean defaultValue)
public byte getByte(java.lang.String key)
public byte getByte(java.lang.String key, byte defaultValue)
public java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
public byte getByte(java.lang.String key, Filter filter)
public java.lang.Byte getByte(java.lang.String key, Filter filter, java.lang.Byte defaultValue)
public byte getByte(java.lang.String key, Filter filter, byte defaultValue)
public double getDouble(java.lang.String key)
public double getDouble(java.lang.String key, double defaultValue)
public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
public double getDouble(java.lang.String key, Filter filter)
public java.lang.Double getDouble(java.lang.String key, Filter filter, java.lang.Double defaultValue)
public double getDouble(java.lang.String key, Filter filter, double defaultValue)
public java.lang.Class getClass(java.lang.String key) throws java.lang.ClassNotFoundException
Class
representation of the class name specified
in the given property
java.lang.ClassNotFoundException
- if the specified class is not foundpublic java.lang.Class getClass(java.lang.String key, java.lang.Class defaultValue) throws java.lang.ClassNotFoundException
Class
representation of the class name specified
in the given property. Or the defaultValue
if no value has
been given to the property.
java.lang.ClassNotFoundException
- if a class has been configured but it is not foundpublic java.lang.Class getClass(java.lang.String key, Filter filter) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.Class getClass(java.lang.String key, Filter filter, java.lang.Class defaultValue) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.Class[] getClassArray(java.lang.String key) throws java.lang.ClassNotFoundException
Class
objects for the class names
specified in the given property
java.lang.ClassNotFoundException
- if the any of the configured classes is not foundpublic java.lang.Class[] getClassArray(java.lang.String key, java.lang.Class[] defaultValue) throws java.lang.ClassNotFoundException
Class
objects for the class names
specified in the given property. Or the defaultValue
if no
value has been given to the property.
java.lang.ClassNotFoundException
- if the any of the configured classes is not foundpublic java.lang.Class[] getClassArray(java.lang.String key, Filter filter) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.Class[] getClassArray(java.lang.String key, Filter filter, java.lang.Class[] defaultValue) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public float getFloat(java.lang.String key)
public float getFloat(java.lang.String key, float defaultValue)
public java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
public float getFloat(java.lang.String key, Filter filter)
public java.lang.Float getFloat(java.lang.String key, Filter filter, java.lang.Float defaultValue)
public float getFloat(java.lang.String key, Filter filter, float defaultValue)
public int getInt(java.lang.String key)
public int getInt(java.lang.String key, int defaultValue)
public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
public int getInt(java.lang.String key, Filter filter)
public java.lang.Integer getInteger(java.lang.String key, Filter filter, java.lang.Integer defaultValue)
public int getInt(java.lang.String key, Filter filter, int defaultValue)
public java.util.List getList(java.lang.String key)
public java.util.List getList(java.lang.String key, java.util.List defaultValue)
public java.util.List getList(java.lang.String key, Filter filter)
public java.util.List getList(java.lang.String key, Filter filter, java.util.List defaultValue)
public long getLong(java.lang.String key)
public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
public long getLong(java.lang.String key, long defaultValue)
public long getLong(java.lang.String key, Filter filter)
public java.lang.Long getLong(java.lang.String key, Filter filter, java.lang.Long defaultValue)
public long getLong(java.lang.String key, Filter filter, long defaultValue)
public short getShort(java.lang.String key)
public java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
public short getShort(java.lang.String key, short defaultValue)
public short getShort(java.lang.String key, Filter filter)
public java.lang.Short getShort(java.lang.String key, Filter filter, java.lang.Short defaultValue)
public short getShort(java.lang.String key, Filter filter, short defaultValue)
public java.lang.String getString(java.lang.String key)
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
public java.lang.String getString(java.lang.String key, Filter filter)
public java.lang.String getString(java.lang.String key, Filter filter, java.lang.String defaultValue)
public java.lang.String[] getStringArray(java.lang.String key)
public java.lang.String[] getStringArray(java.lang.String key, Filter filter)
public java.lang.String[] getStringArray(java.lang.String key, Filter filter, java.lang.String[] defaultValue)
public java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] defaultValue)
public boolean hasBaseConfiguration()
public java.util.List getLoadedSources()
public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
public boolean isThrowExceptionOnMissing()
public java.lang.Long getDelayPeriod()
public java.lang.String getComponentName()
protected java.lang.Object getPropertyWithFilter(java.lang.String key, Filter filter, java.lang.Class theClass, java.lang.Object defaultValue)
protected static java.lang.Object getTypedPropertyWithDefault(java.lang.String key, java.lang.Class theClass, org.apache.commons.configuration.Configuration properties, java.lang.Object defaultValue)
protected void validateValue(java.lang.String key, java.lang.Object value)
protected java.lang.String listToString(java.util.List list)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |