|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.portlets.user.homelibrary.util.config.easyconf.ComponentProperties
public class 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 String |
NULL_STRING
A null string. |
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String NULL_STRING
| Method Detail |
|---|
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 Object getProperty(String key)
public boolean containsKey(String key)
public boolean equals(Object obj)
equals in class Objectpublic Iterator getKeys()
public Iterator getKeys(String prefix)
public int hashCode()
hashCode in class Objectpublic boolean isEmpty()
public void setProperty(String key,
Object value)
public org.apache.commons.configuration.Configuration subset(String prefix)
public String toString()
toString in class Objectpublic 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
NoClassDefFoundError
public boolean getBoolean(String key,
Filter filter)
public Boolean getBoolean(String key,
Filter filter,
Boolean defaultValue)
throws NoClassDefFoundError
NoClassDefFoundError
public boolean getBoolean(String key,
Filter filter,
boolean defaultValue)
public byte getByte(String key)
public byte getByte(String key,
byte defaultValue)
public Byte getByte(String key,
Byte defaultValue)
public byte getByte(String key,
Filter filter)
public Byte getByte(String key,
Filter filter,
Byte defaultValue)
public byte getByte(String key,
Filter filter,
byte defaultValue)
public double getDouble(String key)
public double getDouble(String key,
double defaultValue)
public Double getDouble(String key,
Double defaultValue)
public double getDouble(String key,
Filter filter)
public Double getDouble(String key,
Filter filter,
Double defaultValue)
public double getDouble(String key,
Filter filter,
double defaultValue)
public Class getClass(String key)
throws ClassNotFoundException
Class representation of the class name specified
in the given property
ClassNotFoundException - if the specified class is not found
public 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 found
public Class getClass(String key,
Filter filter)
throws ClassNotFoundException
ClassNotFoundException
public Class getClass(String key,
Filter filter,
Class defaultValue)
throws ClassNotFoundException
ClassNotFoundException
public Class[] getClassArray(String key)
throws ClassNotFoundException
Class objects for the class names
specified in the given property
ClassNotFoundException - if the any of the configured classes is not found
public 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 found
public Class[] getClassArray(String key,
Filter filter)
throws ClassNotFoundException
ClassNotFoundException
public Class[] getClassArray(String key,
Filter filter,
Class[] defaultValue)
throws ClassNotFoundException
ClassNotFoundExceptionpublic float getFloat(String key)
public float getFloat(String key,
float defaultValue)
public Float getFloat(String key,
Float defaultValue)
public float getFloat(String key,
Filter filter)
public Float getFloat(String key,
Filter filter,
Float defaultValue)
public float getFloat(String key,
Filter filter,
float defaultValue)
public int getInt(String key)
public int getInt(String key,
int defaultValue)
public Integer getInteger(String key,
Integer defaultValue)
public int getInt(String key,
Filter filter)
public Integer getInteger(String key,
Filter filter,
Integer defaultValue)
public int getInt(String key,
Filter filter,
int defaultValue)
public List getList(String key)
public List getList(String key,
List defaultValue)
public List getList(String key,
Filter filter)
public List getList(String key,
Filter filter,
List defaultValue)
public long getLong(String key)
public Long getLong(String key,
Long defaultValue)
public long getLong(String key,
long defaultValue)
public long getLong(String key,
Filter filter)
public Long getLong(String key,
Filter filter,
Long defaultValue)
public long getLong(String key,
Filter filter,
long defaultValue)
public short getShort(String key)
public Short getShort(String key,
Short defaultValue)
public short getShort(String key,
short defaultValue)
public short getShort(String key,
Filter filter)
public Short getShort(String key,
Filter filter,
Short defaultValue)
public short getShort(String key,
Filter filter,
short defaultValue)
public String getString(String key)
public String getString(String key,
String defaultValue)
public String getString(String key,
Filter filter)
public String getString(String key,
Filter filter,
String defaultValue)
public String[] getStringArray(String key)
public String[] getStringArray(String key,
Filter filter)
public String[] getStringArray(String key,
Filter filter,
String[] defaultValue)
public String[] getStringArray(String key,
String[] defaultValue)
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)
protected void validateValue(String key,
Object value)
protected String listToString(List list)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||