|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.configuration.AbstractConfiguration | +--org.apache.commons.configuration.CompositeConfiguration
This Configuration class allows you to add multiple different types of Configuration to this CompositeConfiguration. If you add Configuration1, and then Configuration2, any properties shared will mean that Configuration1 will be returned. You can add multiple different types or the same type of properties file. If Configuration1 doesn't have the property, then Configuration2 will be checked.
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
END_TOKEN, START_TOKEN |
Constructor Summary | |
CompositeConfiguration()
Creates an empty CompositeConfiguration object which can then be added some other Configuration files |
|
CompositeConfiguration(Configuration inMemoryConfiguration)
Creates an CompositeConfiguration object with a specified InMemory configuration. |
Method Summary | |
void |
addConfiguration(Configuration config)
Add a configuration. |
protected void |
addPropertyDirect(String key,
Object token)
Add this property to the inmemory Configuration. |
void |
clear()
Remove all configuration reinitialize the in memory configuration. |
void |
clearProperty(String key)
{@inheritDoc} |
boolean |
containsKey(String key)
{@inheritDoc} |
Configuration |
getConfiguration(int index)
Return the configuration at the specified index. |
Configuration |
getInMemoryConfiguration()
Returns the "in memory configuration". |
Iterator |
getKeys()
{@inheritDoc} |
Iterator |
getKeys(String key)
{@inheritDoc} |
List |
getList(String key,
List defaultValue)
{@inheritDoc} |
int |
getNumberOfConfigurations()
Return the number of configurations. |
Object |
getProperty(String key)
Read property from underlying composite |
String[] |
getStringArray(String key)
{@inheritDoc} |
boolean |
isEmpty()
{@inheritDoc} |
void |
removeConfiguration(Configuration config)
Remove a configuration. |
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
addProperty, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getList, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, interpolate, interpolate, interpolateHelper, isThrowExceptionOnMissing, resolveContainerStore, setDelimiter, setProperty, setThrowExceptionOnMissing, subset |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CompositeConfiguration()
public CompositeConfiguration(Configuration inMemoryConfiguration)
inMemoryConfiguration
- the in memory configuration to useMethod Detail |
public void addConfiguration(Configuration config)
config
- the configuration to addpublic void removeConfiguration(Configuration config)
config
- The configuration to removepublic int getNumberOfConfigurations()
public void clear()
clear
in class AbstractConfiguration
protected void addPropertyDirect(String key, Object token)
addPropertyDirect
in class AbstractConfiguration
key
- The Key to add the property to.token
- The Value to add.public Object getProperty(String key)
key
- key to use for mappingpublic Iterator getKeys()
getKeys
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
public Iterator getKeys(String key)
getKeys
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
prefix
- The prefix to test against.Configuration.getKeys()
public boolean isEmpty()
isEmpty
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
true
if the configuration contains no property,
false
otherwise.public void clearProperty(String key)
clearProperty
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- the key to remove along with corresponding value.public boolean containsKey(String key)
containsKey
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- the key whose presence in this configuration is to be testedtrue
if the configuration contains a value for this
key, false
otherwisepublic List getList(String key, List defaultValue)
getList
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a List.public String[] getStringArray(String key)
getStringArray
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a String/List of Strings.public Configuration getConfiguration(int index)
index
- The index of the configuration to retrievepublic Configuration getInMemoryConfiguration()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |