|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.configuration.event.EventSource
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.
| Field Summary |
| Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN |
| Constructor Summary | |
CompositeConfiguration()
Creates an empty CompositeConfiguration object which can then be added some other Configuration files |
|
CompositeConfiguration(Collection configurations)
Create a CompositeConfiguration with an empty in memory configuration and adds the collection of configurations specified. |
|
CompositeConfiguration(Configuration inMemoryConfiguration)
Creates a CompositeConfiguration object with a specified in memory configuration. |
|
CompositeConfiguration(Configuration inMemoryConfiguration,
Collection configurations)
Creates a CompositeConfiguration with a specified in memory configuration, and then adds the given collection of configurations. |
|
| 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. |
protected void |
clearPropertyDirect(String key)
Removes the specified property from this configuration. |
Object |
clone()
Returns a copy of this object. |
boolean |
containsKey(String key)
Check if the configuration contains the specified key. |
Configuration |
getConfiguration(int index)
Return the configuration at the specified index. |
Configuration |
getInMemoryConfiguration()
Returns the "in memory configuration". |
Iterator |
getKeys()
Get the list of the keys contained in the configuration. |
Iterator |
getKeys(String key)
Get the list of the keys contained in the configuration that match the specified prefix. |
List |
getList(String key,
List defaultValue)
Get a List of strings associated with the given configuration key. |
int |
getNumberOfConfigurations()
Return the number of configurations. |
Object |
getProperty(String key)
Read property from underlying composite |
Configuration |
getSource(String key)
Returns the configuration source, in which the specified key is defined. |
String[] |
getStringArray(String key)
Get an array of strings associated with the given configuration key. |
boolean |
isEmpty()
Check if the configuration is empty. |
void |
removeConfiguration(Configuration config)
Remove a configuration. |
void |
setDelimiterParsingDisabled(boolean delimiterParsingDisabled)
Sets a flag whether added values for string properties should be checked for the list delimiter. |
void |
setListDelimiter(char listDelimiter)
Sets the character that is used as list delimiter. |
| Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
addErrorLogListener, addProperty, append, clearProperty, copy, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setLogger, setProperty, setThrowExceptionOnMissing, subset |
| Methods inherited from class org.apache.commons.configuration.event.EventSource |
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CompositeConfiguration()
public CompositeConfiguration(Configuration inMemoryConfiguration)
inMemoryConfiguration - the in memory configuration to usepublic CompositeConfiguration(Collection configurations)
configurations - the collection of configurations to add
public CompositeConfiguration(Configuration inMemoryConfiguration,
Collection configurations)
inMemoryConfiguration - the in memory configuration to useconfigurations - the collection of configurations to add| Method 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 interface Configurationclear in class AbstractConfiguration
protected void addPropertyDirect(String key,
Object token)
addPropertyDirect in class AbstractConfigurationkey - The Key to add the property to.token - The Value to add.public Object getProperty(String key)
getProperty in interface Configurationkey - key to use for mapping
public Iterator getKeys()
Configurationremove() method is specific to
a concrete implementation. It may remove the corresponding
property from the configuration, but this is not guaranteed. In any case
it is no replacement for calling
Configuration.clearProperty(String) for this property. So it is
highly recommended to avoid using the iterator's remove()
method.
getKeys in interface Configurationpublic Iterator getKeys(String key)
Configuration
getKeys in interface ConfigurationgetKeys in class AbstractConfigurationpublic boolean isEmpty()
Configuration
isEmpty in interface Configurationtrue if the configuration contains no property,
false otherwise.protected void clearPropertyDirect(String key)
AbstractConfigurationclearProperty() after it has done some
preparations. It should be overriden in sub classes. This base
implementation is just left empty.
clearPropertyDirect in class AbstractConfigurationkey - the key to be removedpublic boolean containsKey(String key)
Configuration
containsKey in interface Configurationkey - the key whose presence in this configuration is to be tested
true if the configuration contains a value for this
key, false otherwise
public List getList(String key,
List defaultValue)
Configuration
getList in interface ConfigurationgetList in class AbstractConfigurationpublic String[] getStringArray(String key)
AbstractConfigurationsetListDelimiter() method. If this is the case, the string
is splitted at these positions resulting in a property with multiple
values.
getStringArray in interface ConfigurationgetStringArray in class AbstractConfigurationkey - The configuration key.
AbstractConfiguration.setListDelimiter(char),
AbstractConfiguration.setDelimiterParsingDisabled(boolean)public Configuration getConfiguration(int index)
index - The index of the configuration to retrieve
public Configuration getInMemoryConfiguration()
public Object clone()
clone in class EventSourcepublic void setDelimiterParsingDisabled(boolean delimiterParsingDisabled)
setDelimiterParsingDisabled in class AbstractConfigurationdelimiterParsingDisabled - the new value of the flagpublic void setListDelimiter(char listDelimiter)
setListDelimiter in class AbstractConfigurationlistDelimiter - the new list delimiter characterpublic Configuration getSource(String key)
IllegalArgumentException is thrown.
In this case the source configuration cannot be determined.
key - the key to be checked
IllegalArgumentException - if the source configuration cannot be
determined
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||