public class ComponentProperties extends Object
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.| Modifier and Type | Field and Description |
|---|---|
static String |
NULL_STRING
A null string.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key) |
boolean |
equals(Object obj) |
BigDecimal |
getBigDecimal(String key) |
BigDecimal |
getBigDecimal(String key,
BigDecimal defaultValue) |
BigDecimal |
getBigDecimal(String key,
Filter filter) |
BigDecimal |
getBigDecimal(String key,
Filter filter,
BigDecimal defaultValue) |
BigInteger |
getBigInteger(String key) |
BigInteger |
getBigInteger(String key,
BigInteger defaultValue) |
BigInteger |
getBigInteger(String key,
Filter filter) |
BigInteger |
getBigInteger(String key,
Filter filter,
BigInteger defaultValue) |
boolean |
getBoolean(String key) |
boolean |
getBoolean(String key,
boolean defaultValue) |
Boolean |
getBoolean(String key,
Boolean defaultValue) |
boolean |
getBoolean(String key,
Filter filter) |
boolean |
getBoolean(String key,
Filter filter,
boolean defaultValue) |
Boolean |
getBoolean(String key,
Filter filter,
Boolean defaultValue) |
byte |
getByte(String key) |
byte |
getByte(String key,
byte defaultValue) |
Byte |
getByte(String key,
Byte defaultValue) |
byte |
getByte(String key,
Filter filter) |
byte |
getByte(String key,
Filter filter,
byte defaultValue) |
Byte |
getByte(String key,
Filter filter,
Byte defaultValue) |
Class |
getClass(String key)
Get the
Class representation of the class name specified
in the given property |
Class |
getClass(String key,
Class defaultValue)
Get the
Class representation of the class name specified
in the given property. |
Class |
getClass(String key,
Filter filter)
Similar to the previous methods but complementing the property key with
the given filter
|
Class |
getClass(String key,
Filter filter,
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
|
Class[] |
getClassArray(String key)
Get an array of
Class objects for the class names
specified in the given property |
Class[] |
getClassArray(String key,
Class[] defaultValue)
Get an array of
Class objects for the class names
specified in the given property. |
Class[] |
getClassArray(String key,
Filter filter)
Similar to the previous methods but complementing the property key with
the given filter
|
Class[] |
getClassArray(String key,
Filter filter,
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
|
String |
getComponentName() |
Long |
getDelayPeriod()
Returned the configured delay period for this component or null if
reloading is not being performed
|
double |
getDouble(String key) |
double |
getDouble(String key,
double defaultValue) |
Double |
getDouble(String key,
Double defaultValue) |
double |
getDouble(String key,
Filter filter) |
double |
getDouble(String key,
Filter filter,
double defaultValue) |
Double |
getDouble(String key,
Filter filter,
Double defaultValue) |
float |
getFloat(String key) |
float |
getFloat(String key,
Filter filter) |
float |
getFloat(String key,
Filter filter,
float defaultValue) |
Float |
getFloat(String key,
Filter filter,
Float defaultValue) |
float |
getFloat(String key,
float defaultValue) |
Float |
getFloat(String key,
Float defaultValue) |
int |
getInt(String key) |
int |
getInt(String key,
Filter filter) |
int |
getInt(String key,
Filter filter,
int defaultValue) |
int |
getInt(String key,
int defaultValue) |
Integer |
getInteger(String key,
Filter filter,
Integer defaultValue) |
Integer |
getInteger(String key,
Integer defaultValue) |
Iterator |
getKeys() |
Iterator |
getKeys(String prefix) |
List |
getList(String key) |
List |
getList(String key,
Filter filter) |
List |
getList(String key,
Filter filter,
List defaultValue) |
List |
getList(String key,
List defaultValue) |
List |
getLoadedSources()
Get a list of the sources which have been loaded for this component
|
long |
getLong(String key) |
long |
getLong(String key,
Filter filter) |
long |
getLong(String key,
Filter filter,
long defaultValue) |
Long |
getLong(String key,
Filter filter,
Long defaultValue) |
long |
getLong(String key,
long defaultValue) |
Long |
getLong(String key,
Long defaultValue) |
Properties |
getProperties()
Returns a copy of the configuration into a
java.util.Properties class.
|
Object |
getProperty(String key) |
protected Object |
getPropertyWithFilter(String key,
Filter filter,
Class theClass,
Object defaultValue) |
short |
getShort(String key) |
short |
getShort(String key,
Filter filter) |
short |
getShort(String key,
Filter filter,
short defaultValue) |
Short |
getShort(String key,
Filter filter,
Short defaultValue) |
short |
getShort(String key,
short defaultValue) |
Short |
getShort(String key,
Short defaultValue) |
String |
getString(String key)
Get the String value of the given key.
|
String |
getString(String key,
Filter filter) |
String |
getString(String key,
Filter filter,
String defaultValue) |
String |
getString(String key,
String defaultValue) |
String[] |
getStringArray(String key) |
String[] |
getStringArray(String key,
Filter filter) |
String[] |
getStringArray(String key,
Filter filter,
String[] defaultValue) |
String[] |
getStringArray(String key,
String[] defaultValue) |
protected static Object |
getTypedPropertyWithDefault(String key,
Class theClass,
org.apache.commons.configuration.Configuration properties,
Object defaultValue) |
boolean |
hasBaseConfiguration() |
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isThrowExceptionOnMissing() |
protected String |
listToString(List list) |
void |
setProperty(String key,
Object value) |
void |
setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
Set the flag throwExceptionOnMissing.
|
org.apache.commons.configuration.Configuration |
subset(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.
|
Map |
toMap()
Returns a decorator of the configuration that implements the Map
interface.
|
String |
toString() |
protected void |
validateValue(String key,
Object value) |
public static final String NULL_STRING
public 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 Properties getProperties()
Properties instancepublic boolean containsKey(String key)
public Iterator getKeys()
public boolean isEmpty()
public org.apache.commons.configuration.Configuration subset(String prefix)
public BigDecimal getBigDecimal(String key)
public BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
public BigDecimal getBigDecimal(String key, Filter filter)
public BigDecimal getBigDecimal(String key, Filter filter, BigDecimal defaultValue)
public BigInteger getBigInteger(String key)
public BigInteger getBigInteger(String key, BigInteger defaultValue)
public BigInteger getBigInteger(String key, Filter filter)
public BigInteger getBigInteger(String key, Filter filter, BigInteger defaultValue)
public boolean getBoolean(String key)
public boolean getBoolean(String key, boolean defaultValue)
public Boolean getBoolean(String key, Boolean defaultValue) throws NoClassDefFoundError
NoClassDefFoundErrorpublic Boolean getBoolean(String key, Filter filter, Boolean defaultValue) throws NoClassDefFoundError
NoClassDefFoundErrorpublic byte getByte(String key)
public byte getByte(String key, byte defaultValue)
public double getDouble(String key)
public double getDouble(String key, double defaultValue)
public Class getClass(String key) throws ClassNotFoundException
Class representation of the class name specified
in the given propertyClassNotFoundException - if the specified class is not foundpublic Class getClass(String key, Class defaultValue) throws ClassNotFoundException
Class representation of the class name specified
in the given property. Or the defaultValue if no value has
been given to the property.ClassNotFoundException - if a class has been configured but it is not foundpublic Class getClass(String key, Filter filter) throws ClassNotFoundException
ClassNotFoundExceptionpublic Class getClass(String key, Filter filter, Class defaultValue) throws ClassNotFoundException
ClassNotFoundExceptionpublic Class[] getClassArray(String key) throws ClassNotFoundException
Class objects for the class names
specified in the given propertyClassNotFoundException - if the any of the configured classes is not foundpublic Class[] getClassArray(String key, Class[] defaultValue) throws ClassNotFoundException
Class objects for the class names
specified in the given property. Or the defaultValue if no
value has been given to the property.ClassNotFoundException - if the any of the configured classes is not foundpublic Class[] getClassArray(String key, Filter filter) throws ClassNotFoundException
ClassNotFoundExceptionpublic Class[] getClassArray(String key, Filter filter, Class[] defaultValue) throws ClassNotFoundException
ClassNotFoundExceptionpublic float getFloat(String key)
public float getFloat(String key, float defaultValue)
public int getInt(String key)
public int getInt(String key, int defaultValue)
public long getLong(String key)
public long getLong(String key, long defaultValue)
public short getShort(String key)
public short getShort(String key, short defaultValue)
public String getString(String key)
public boolean hasBaseConfiguration()
public List getLoadedSources()
public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
public boolean isThrowExceptionOnMissing()
public Long getDelayPeriod()
public String getComponentName()
protected Object getPropertyWithFilter(String key, Filter filter, Class theClass, Object defaultValue)
protected static Object getTypedPropertyWithDefault(String key, Class theClass, org.apache.commons.configuration.Configuration properties, Object defaultValue)
Copyright © 2020. All Rights Reserved.