Class AbstractConfiguration
java.lang.Object
org.apache.commons.configuration.event.EventSource
org.apache.commons.configuration.AbstractConfiguration
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
AppletConfiguration, BaseConfiguration, CompositeConfiguration, DatabaseConfiguration, DataConfiguration, HierarchicalConfiguration, JNDIConfiguration, MapConfiguration, ServletConfiguration, ServletContextConfiguration, ServletFilterConfiguration, ServletRequestConfiguration, SubsetConfiguration
Abstract configuration class. Provides basic functionality but does not store any data.
If you want to write your own Configuration class then you should
implement only abstract methods from this class. A lot of functionality
needed by typical implementations of the Configuration
interface is already provided by this base class. Following is a list of
features implemented here:
- Data conversion support. The various data types required by the
Configurationinterface are already handled by this base class. A concrete sub class only needs to provide a genericgetProperty()method. - Support for variable interpolation. Property values containing special
variable tokens (like
${var}) will be replaced by their corresponding values. - Support for string lists. The values of properties to be added to this
configuration are checked whether they contain a list delimiter character. If
this is the case and if list splitting is enabled, the string is split and
multiple values are added for this property. (With the
setListDelimiter()method the delimiter character can be specified; per default a comma is used. ThesetDelimiterParsingDisabled()method can be used to disable list splitting completely.) - Allows to specify how missing properties are treated. Per default the
get methods returning an object will return null if the searched
property key is not found (and no default value is provided). With the
setThrowExceptionOnMissing()method this behavior can be changed to throw an exception when a requested property cannot be found. - Basic event support. Whenever this configuration is modified registered
event listeners are notified. Refer to the various
EVENT_XXXconstants to get an impression about which event types are supported.
- Version:
- $Id: AbstractConfiguration.java 1534064 2013-10-21 08:44:33Z henning $
- Author:
- Konstantin Shaposhnikov , Henning P. Schmiedehausen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringend tokenstatic final intConstant for the add property event type.static final intConstant for the clear configuration event type.static final intConstant for the clear property event type.static final intConstant for the get property event type.static final intConstant for the set property event type.protected static final Stringstart token -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a specialConfigurationErrorListenerobject to this configuration that will log all internal errors.voidaddProperty(String key, Object value) Add a property to the configuration.protected abstract voidaddPropertyDirect(String key, Object value) Adds a key/value pair to the Configuration.voidAppends the content of the specified configuration to this configuration.voidclear()Remove all properties from the configuration.voidclearProperty(String key) Removes the specified property from this configuration.protected voidRemoves the specified property from this configuration.voidCopies the content of the specified configuration into this configuration.protected ConfigurationInterpolatorCreates the interpolator object that is responsible for variable interpolation.getBigDecimal(String key) Get aBigDecimalassociated with the given configuration key.getBigDecimal(String key, BigDecimal defaultValue) Get aBigDecimalassociated with the given configuration key.getBigInteger(String key) Get aBigIntegerassociated with the given configuration key.getBigInteger(String key, BigInteger defaultValue) Get aBigIntegerassociated with the given configuration key.booleangetBoolean(String key) Get a boolean associated with the given configuration key.booleangetBoolean(String key, boolean defaultValue) Get a boolean associated with the given configuration key.getBoolean(String key, Boolean defaultValue) Obtains the value of the specified key and tries to convert it into aBooleanobject.byteGet a byte associated with the given configuration key.byteGet a byte associated with the given configuration key.Get aByteassociated with the given configuration key.static charRetrieve the current delimiter.static charDeprecated.Use AbstractConfiguration.getDefaultListDelimiter() insteaddoubleGet a double associated with the given configuration key.doubleGet a double associated with the given configuration key.Get aDoubleassociated with the given configuration key.floatGet a float associated with the given configuration key.floatGet a float associated with the given configuration key.Get aFloatassociated with the given configuration key.intGet a int associated with the given configuration key.intGet a int associated with the given configuration key.getInteger(String key, Integer defaultValue) Get anIntegerassociated with the given configuration key.Returns theConfigurationInterpolatorobject that manages the lookup objects for resolving variables.Get the list of the keys contained in the configuration that match the specified prefix.Get a List of strings associated with the given configuration key.Get a List of strings associated with the given configuration key.charRetrieve the delimiter for this configuration.org.apache.commons.logging.LogReturns the logger used by this configuration object.longGet a long associated with the given configuration key.longGet a long associated with the given configuration key.Get aLongassociated with the given configuration key.getProperties(String key) Get a list of properties associated with the given configuration key.getProperties(String key, Properties defaults) Get a list of properties associated with the given configuration key.shortGet a short associated with the given configuration key.shortGet a short associated with the given configuration key.Get aShortassociated with the given configuration key.Get a string associated with the given configuration key.Get a string associated with the given configuration key.String[]getStringArray(String key) Get an array of strings associated with the given configuration key.org.apache.commons.lang.text.StrSubstitutorReturns the object that is responsible for variable interpolation.protected Objectinterpolate(Object value) Returns the interpolated value.protected Stringinterpolate(String base) interpolate key names to handle ${key} stuffReturns a configuration with the same content as this configuration, but with all variables replaced by their actual values.protected StringinterpolateHelper(String base, List<?> priorVariables) Deprecated.Interpolation is now handled byPropertyConverter; this method will no longer be calledbooleanDetermine if this configuration is using delimiters when parsing property values to convert them to lists of values.protected booleanisScalarValue(Object value) Checks whether the specified object is a scalar value.booleanReturns true if missing values throw Exceptions.protected ObjectReturns an object from the store described by the key.static voidsetDefaultListDelimiter(char delimiter) For configurations extending AbstractConfiguration, allow them to change the listDelimiter from the default comma (",").static voidsetDelimiter(char delimiter) Deprecated.Use AbstractConfiguration.setDefaultListDelimiter(char) insteadvoidsetDelimiterParsingDisabled(boolean delimiterParsingDisabled) Set whether this configuration should use delimiters when parsing property values to convert them to lists of values.voidsetListDelimiter(char listDelimiter) Change the list delimiter for this configuration.voidsetLogger(org.apache.commons.logging.Log log) Allows to set the logger to be used by this configuration object.voidsetProperty(String key, Object value) Set a property, this will replace any previously set values.voidsetThrowExceptionOnMissing(boolean throwExceptionOnMissing) Allows to set thethrowExceptionOnMissingflag.Return a decorator Configuration containing every key from the current Configuration that starts with the specified prefix.Methods inherited from class EventSource
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, clone, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEventsMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Configuration
containsKey, getKeys, getProperty, isEmpty
-
Field Details
-
EVENT_ADD_PROPERTY
Constant for the add property event type.- Since:
- 1.3
- See Also:
-
EVENT_CLEAR_PROPERTY
Constant for the clear property event type.- Since:
- 1.3
- See Also:
-
EVENT_SET_PROPERTY
Constant for the set property event type.- Since:
- 1.3
- See Also:
-
EVENT_CLEAR
Constant for the clear configuration event type.- Since:
- 1.3
- See Also:
-
EVENT_READ_PROPERTY
Constant for the get property event type. This event type is used for error events.- Since:
- 1.4
- See Also:
-
START_TOKEN
-
END_TOKEN
-
-
Constructor Details
-
AbstractConfiguration
public AbstractConfiguration()Creates a new instance ofAbstractConfiguration.
-
-
Method Details
-
setDefaultListDelimiter
For configurations extending AbstractConfiguration, allow them to change the listDelimiter from the default comma (","). This value will be used only when creating new configurations. Those already created will not be affected by this change- Parameters:
delimiter- The new listDelimiter
-
setDelimiter
Deprecated.Use AbstractConfiguration.setDefaultListDelimiter(char) insteadSets the default list delimiter.- Parameters:
delimiter- the delimiter character
-
getDefaultListDelimiter
Retrieve the current delimiter. By default this is a comma (",").- Returns:
- The delimiter in use
-
getDelimiter
Deprecated.Use AbstractConfiguration.getDefaultListDelimiter() insteadReturns the default list delimiter.- Returns:
- the default list delimiter
-
setListDelimiter
Change the list delimiter for this configuration. Note: this change will only be effective for new parsings. If you want it to take effect for all loaded properties use the no arg constructor and call this method before setting the source.- Parameters:
listDelimiter- The new listDelimiter
-
getListDelimiter
Retrieve the delimiter for this configuration. The default is the value of defaultListDelimiter.- Returns:
- The listDelimiter in use
-
isDelimiterParsingDisabled
Determine if this configuration is using delimiters when parsing property values to convert them to lists of values. Defaults to false- Returns:
- true if delimiters are not being used
-
setDelimiterParsingDisabled
Set whether this configuration should use delimiters when parsing property values to convert them to lists of values. By default delimiter parsing is enabled Note: this change will only be effective for new parsings. If you want it to take effect for all loaded properties use the no arg constructor and call this method before setting source.- Parameters:
delimiterParsingDisabled- a flag whether delimiter parsing should be disabled
-
setThrowExceptionOnMissing
Allows to set thethrowExceptionOnMissingflag. This flag controls the behavior of property getter methods that return objects if the requested property is missing. If the flag is set to false (which is the default value), these methods will return null. If set to true, they will throw aNoSuchElementExceptionexception. Note that getter methods for primitive data types are not affected by this flag.- Parameters:
throwExceptionOnMissing- The new value for the property
-
isThrowExceptionOnMissing
Returns true if missing values throw Exceptions.- Returns:
- true if missing values throw Exceptions
-
getSubstitutor
Returns the object that is responsible for variable interpolation.- Returns:
- the object responsible for variable interpolation
- Since:
- 1.4
-
getInterpolator
Returns theConfigurationInterpolatorobject that manages the lookup objects for resolving variables. Note: If this object is manipulated (e.g. new lookup objects added), synchronization has to be manually ensured. BecauseConfigurationInterpolatoris not thread-safe concurrent access to properties of this configuration instance (which causes the interpolator to be invoked) may cause race conditions.- Returns:
- the
ConfigurationInterpolatorassociated with this configuration - Since:
- 1.4
-
createInterpolator
Creates the interpolator object that is responsible for variable interpolation. This method is invoked on first access of the interpolation features. It creates a new instance ofConfigurationInterpolatorand sets the default lookup object to an implementation that queries this configuration.- Returns:
- the newly created interpolator object
- Since:
- 1.4
-
getLogger
Returns the logger used by this configuration object.- Returns:
- the logger
- Since:
- 1.4
-
setLogger
Allows to set the logger to be used by this configuration object. This method makes it possible for clients to exactly control logging behavior. Per default a logger is set that will ignore all log messages. Derived classes that want to enable logging should call this method during their initialization with the logger to be used.- Parameters:
log- the new logger- Since:
- 1.4
-
addErrorLogListener
Adds a specialConfigurationErrorListenerobject to this configuration that will log all internal errors. This method is intended to be used by certain derived classes, for which it is known that they can fail on property access (e.g.DatabaseConfiguration).- Since:
- 1.4
-
addProperty
Description copied from interface:ConfigurationAdd a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if the property:resource.loader = file
is already present in the configuration and you calladdProperty("resource.loader", "classpath")Then you will end up with a List like the following:["file", "classpath"]
- Specified by:
addPropertyin interfaceConfiguration- Parameters:
key- The key to add the property to.value- The value to add.
-
addPropertyDirect
Adds a key/value pair to the Configuration. Override this method to provide write access to underlying Configuration store.- Parameters:
key- key to use for mappingvalue- object to store
-
interpolate
interpolate key names to handle ${key} stuff- Parameters:
base- string to interpolate- Returns:
- returns the key name with the ${key} substituted
-
interpolate
Returns the interpolated value. Non String values are returned without change.- Parameters:
value- the value to interpolate- Returns:
- returns the value with variables substituted
-
interpolateHelper
Deprecated.Interpolation is now handled byPropertyConverter; this method will no longer be calledRecursive handler for multple levels of interpolation. When called the first time, priorVariables should be null.- Parameters:
base- string with the ${key} variablespriorVariables- serves two purposes: to allow checking for loops, and creating a meaningful exception message should a loop occur. It's 0'th element will be set to the value of base from the first call. All subsequent interpolated variables are added afterward.- Returns:
- the string with the interpolation taken care of
-
subset
Description copied from interface:ConfigurationReturn a decorator Configuration containing every key from the current Configuration that starts with the specified prefix. The prefix is removed from the keys in the subset. For example, if the configuration contains the following properties:prefix.number = 1 prefix.string = Apache prefixed.foo = bar prefix = Jakarta
the Configuration returned bysubset("prefix")will contain the properties:number = 1 string = Apache = Jakarta
(The key for the value "Jakarta" is an empty string)Since the subset is a decorator and not a modified copy of the initial Configuration, any change made to the subset is available to the Configuration, and reciprocally.
- Specified by:
subsetin interfaceConfiguration- Parameters:
prefix- The prefix used to select the properties.- Returns:
- a subset configuration
- See Also:
-
setProperty
Description copied from interface:ConfigurationSet a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key, value).- Specified by:
setPropertyin interfaceConfiguration- Parameters:
key- The key of the property to changevalue- The new value
-
clearProperty
Removes the specified property from this configuration. This implementation performs some preparations and then delegates toclearPropertyDirect(), which will do the real work.- Specified by:
clearPropertyin interfaceConfiguration- Parameters:
key- the key to be removed
-
clearPropertyDirect
Removes the specified property from this configuration. This method is called byclearProperty()after it has done some preparations. It should be overridden in sub classes. This base implementation is just left empty.- Parameters:
key- the key to be removed
-
clear
Description copied from interface:ConfigurationRemove all properties from the configuration.- Specified by:
clearin interfaceConfiguration
-
getKeys
Get the list of the keys contained in the configuration that match the specified prefix. For instance, if the configuration contains the following keys:
db.user, db.pwd, db.url, window.xpos, window.ypos,
an invocation ofgetKeys("db");
will return the keys below:
db.user, db.pwd, db.url.
Note that the prefix itself is included in the result set if there is a matching key. The exact behavior - how the prefix is actually interpreted - depends on a concrete implementation. This implementation returns keys that either match the prefix or start with the prefix followed by a dot ('.'). So the callgetKeys("db");will find the keysdb,db.user, ordb.password, but not the keydbdriver.- Specified by:
getKeysin interfaceConfiguration- Parameters:
prefix- The prefix to test against.- Returns:
- An Iterator of keys that match the prefix.
- See Also:
-
getProperties
Description copied from interface:ConfigurationGet a list of properties associated with the given configuration key. This method expects the given key to have an arbitrary number of String values, each of which is of the form {code key=value}. These strings are split at the equals sign, and the key parts will become keys of the returnedPropertiesobject, the value parts become values.- Specified by:
getPropertiesin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated properties if key is found.
-
getProperties
Get a list of properties associated with the given configuration key.- Parameters:
key- The configuration key.defaults- Any default values for the returnedPropertiesobject. Ignored ifnull.- Returns:
- The associated properties if key is found.
- Throws:
ConversionException- is thrown if the key maps to an object that is not a String/List of Strings.IllegalArgumentException- if one of the tokens is malformed (does not contain an equals sign).
-
getBoolean
Get a boolean associated with the given configuration key.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated boolean.
- See Also:
-
getBoolean
Get a boolean associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated boolean.
- See Also:
-
getBoolean
Obtains the value of the specified key and tries to convert it into aBooleanobject. If the property has no value, the passed in default value will be used.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
key- the key of the propertydefaultValue- the default value- Returns:
- the value of this key converted to a
Boolean - Throws:
ConversionException- if the value cannot be converted to aBoolean- See Also:
-
getByte
Description copied from interface:ConfigurationGet a byte associated with the given configuration key.- Specified by:
getBytein interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated byte.
-
getByte
Description copied from interface:ConfigurationGet a byte associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBytein interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated byte.
-
getByte
Description copied from interface:ConfigurationGet aByteassociated with the given configuration key.- Specified by:
getBytein interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated byte if key is found and has valid format, default value otherwise.
-
getDouble
Description copied from interface:ConfigurationGet a double associated with the given configuration key.- Specified by:
getDoublein interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated double.
-
getDouble
Description copied from interface:ConfigurationGet a double associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getDoublein interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated double.
-
getDouble
Description copied from interface:ConfigurationGet aDoubleassociated with the given configuration key.- Specified by:
getDoublein interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated double if key is found and has valid format, default value otherwise.
-
getFloat
Description copied from interface:ConfigurationGet a float associated with the given configuration key.- Specified by:
getFloatin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated float.
-
getFloat
Description copied from interface:ConfigurationGet a float associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getFloatin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated float.
-
getFloat
Description copied from interface:ConfigurationGet aFloatassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getFloatin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated float if key is found and has valid format, default value otherwise.
-
getInt
Description copied from interface:ConfigurationGet a int associated with the given configuration key.- Specified by:
getIntin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated int.
-
getInt
Description copied from interface:ConfigurationGet a int associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getIntin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated int.
-
getInteger
Description copied from interface:ConfigurationGet anIntegerassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getIntegerin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated int if key is found and has valid format, default value otherwise.
-
getLong
Description copied from interface:ConfigurationGet a long associated with the given configuration key.- Specified by:
getLongin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated long.
-
getLong
Description copied from interface:ConfigurationGet a long associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getLongin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated long.
-
getLong
Description copied from interface:ConfigurationGet aLongassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getLongin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated long if key is found and has valid format, default value otherwise.
-
getShort
Description copied from interface:ConfigurationGet a short associated with the given configuration key.- Specified by:
getShortin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated short.
-
getShort
Description copied from interface:ConfigurationGet a short associated with the given configuration key.- Specified by:
getShortin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated short.
-
getShort
Description copied from interface:ConfigurationGet aShortassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getShortin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated short if key is found and has valid format, default value otherwise.
-
getBigDecimal
Get aBigDecimalassociated with the given configuration key.- Specified by:
getBigDecimalin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated BigDecimal if key is found and has valid format
- See Also:
-
getBigDecimal
Description copied from interface:ConfigurationGet aBigDecimalassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBigDecimalin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated BigDecimal if key is found and has valid format, default value otherwise.
-
getBigInteger
Get aBigIntegerassociated with the given configuration key.- Specified by:
getBigIntegerin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated BigInteger if key is found and has valid format
- See Also:
-
getBigInteger
Description copied from interface:ConfigurationGet aBigIntegerassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBigIntegerin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated BigInteger if key is found and has valid format, default value otherwise.
-
getString
Get a string associated with the given configuration key.- Specified by:
getStringin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated string.
- See Also:
-
getString
Description copied from interface:ConfigurationGet a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getStringin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated string if key is found and has valid format, default value otherwise.
-
getStringArray
Get an array of strings associated with the given configuration key. If the key doesn't map to an existing object, an empty array is returned. If a property is added to a configuration, it is checked whether it contains multiple values. This is obvious if the added object is a list or an array. For strings it is checked whether the string contains the list delimiter character that can be specified using thesetListDelimiter()method. If this is the case, the string is split at these positions resulting in a property with multiple values.- Specified by:
getStringArrayin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated string array if key is found.
- Throws:
ConversionException- is thrown if the key maps to an object that is not a String/List of Strings.- See Also:
-
getList
Get a List of strings associated with the given configuration key. If the key doesn't map to an existing object an empty List is returned.- Specified by:
getListin interfaceConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated List.
- See Also:
-
getList
Description copied from interface:ConfigurationGet a List of strings associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getListin interfaceConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated List of strings.
-
resolveContainerStore
Returns an object from the store described by the key. If the value is a Collection object, replace it with the first object in the collection.- Parameters:
key- The property key.- Returns:
- value Value, transparently resolving a possible collection dependency.
-
isScalarValue
Checks whether the specified object is a scalar value. This method is called bygetList()andgetStringArray()if the property requested is not a string, a list, or an array. If it returns true, the calling method transforms the value to a string and returns a list or an array with this single element. This implementation returns true if the value is of a wrapper type for a primitive type.- Parameters:
value- the value to be checked- Returns:
- a flag whether the value is a scalar
- Since:
- 1.7
-
copy
Copies the content of the specified configuration into this configuration. If the specified configuration contains a key that is also present in this configuration, the value of this key will be replaced by the new value. Note: This method won't work well when copying hierarchical configurations because it is not able to copy information about the properties' structure (i.e. the parent-child-relationships will get lost). So when dealing with hierarchical configuration objects theirclone()methods should be used.- Parameters:
c- the configuration to copy (can be null, then this operation will have no effect)- Since:
- 1.5
-
append
Appends the content of the specified configuration to this configuration. The values of all properties contained in the specified configuration will be appended to this configuration. So if a property is already present in this configuration, its new value will be a union of the values in both configurations. Note: This method won't work well when appending hierarchical configurations because it is not able to copy information about the properties' structure (i.e. the parent-child-relationships will get lost). So when dealing with hierarchical configuration objects theirclone()methods should be used.- Parameters:
c- the configuration to be appended (can be null, then this operation will have no effect)- Since:
- 1.5
-
interpolatedConfiguration
Returns a configuration with the same content as this configuration, but with all variables replaced by their actual values. This method tries to clone the configuration and then perform interpolation on all properties. So property values of the form${var}will be resolved as far as possible (if a variable cannot be resolved, it remains unchanged). This operation is useful if the content of a configuration is to be exported or processed by an external component that does not support variable interpolation.- Returns:
- a configuration with all variables interpolated
- Throws:
ConfigurationRuntimeException- if this configuration cannot be cloned- Since:
- 1.5
-