## org.apache.commons.configuration
Class DynamicCombinedConfiguration

    java.lang.Object
      org.apache.commons.configuration.event.EventSource
          org.apache.commons.configuration.AbstractConfiguration
              org.apache.commons.configuration.HierarchicalConfiguration
                  org.apache.commons.configuration.HierarchicalReloadableConfiguration
                      org.apache.commons.configuration.CombinedConfiguration
                          org.apache.commons.configuration.DynamicCombinedConfiguration

All Implemented Interfaces:
  Serializable, Cloneable, Configuration, ConfigurationListener, Reloadable

    public class DynamicCombinedConfiguration

extends CombinedConfiguration

DynamicCombinedConfiguration allows a set of CombinedConfigurations to be used. Each CombinedConfiguration is referenced by a key that is dynamically constructed from a key pattern on each call. The key pattern will be resolved using the configured ConfigurationInterpolator.

Since:
  1.6
Version:
  $Id: DynamicCombinedConfiguration.java 1231721 2012-01-15 18:32:07Z oheger $
Author:
  Commons Configuration team
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.commons.configuration.HierarchicalConfiguration
`HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor`

Field Summary

Fields inherited from class org.apache.commons.configuration.CombinedConfiguration
`EVENT_COMBINED_INVALIDATE`

Fields inherited from class org.apache.commons.configuration.HierarchicalConfiguration
`EVENT_ADD_NODES, EVENT_CLEAR_TREE, EVENT_SUBNODE_CHANGED`

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
`DynamicCombinedConfiguration()` Creates a new instance of `DynamicCombinedConfiguration` that uses a union combiner.
`DynamicCombinedConfiguration(NodeCombiner comb)` Creates a new instance of `DynamicCombinedConfiguration` and initializes the combiner to be used.

Method Summary
`void` `addConfiguration(AbstractConfiguration config, String name, String at)` Adds a new configuration to this combined configuration.
`void` `addConfigurationListener(ConfigurationListener l)` Adds a configuration listener to this object.
`void` `addErrorListener(ConfigurationErrorListener l)` Adds a new configuration error listener to this object.
`void` `addNodes(String key, Collection<? extends ConfigurationNode> nodes)` Adds a collection of nodes at the specified position of the configuration tree.
`void` `addProperty(String key, Object value)` Add a property to the configuration.
`void` `clear()` Clears this configuration.
`void` `clearConfigurationListeners()` Removes all registered configuration listeners.
`void` `clearErrorListeners()` Removes all registered error listeners.
`void` `clearProperty(String key)` Removes the property with the given key.
`void` `clearTree(String key)` Removes all values of the property with the given name and of keys that start with this name.
`Object` `clone()` Returns a copy of this object.
`SubnodeConfiguration` `configurationAt(String key)` Returns a hierarchical subnode configuration for the node specified by the given key.
`SubnodeConfiguration` `configurationAt(String key, boolean supportUpdates)` Returns a hierarchical subnode configuration object that wraps the configuration node specified by the given key.
`List<HierarchicalConfiguration>` `configurationsAt(String key)` Returns a list of sub configurations for all configuration nodes selected by the given key.
`boolean` `containsKey(String key)` Checks if the specified key is contained in this configuration.
`BigDecimal` `getBigDecimal(String key)` Get a `BigDecimal` associated with the given configuration key.
`BigDecimal` `getBigDecimal(String key, BigDecimal defaultValue)` Get a `BigDecimal` associated with the given configuration key.
`BigInteger` `getBigInteger(String key)` Get a `BigInteger` associated with the given configuration key.
`BigInteger` `getBigInteger(String key, BigInteger defaultValue)` Get a `BigInteger` associated with the given configuration key.
`boolean` `getBoolean(String key)` Get a boolean associated with the given configuration key.
`boolean` `getBoolean(String key, boolean defaultValue)` Get a boolean associated with the given configuration key.
`Boolean` `getBoolean(String key, Boolean defaultValue)` Obtains the value of the specified key and tries to convert it into a `Boolean` object.
`byte` `getByte(String key)` Get a byte associated with the given configuration key.
`byte` `getByte(String key, byte defaultValue)` Get a byte associated with the given configuration key.
`Byte` `getByte(String key, Byte defaultValue)` Get a `Byte` associated with the given configuration key.
`Configuration` `getConfiguration(int index)` Returns the configuration at the specified index.
`Configuration` `getConfiguration(String name)` Returns the configuration with the given name.
`Collection<ConfigurationListener>` `getConfigurationListeners()` Returns a collection with all configuration event listeners that are currently registered at this object.
`Set<String>` `getConfigurationNames()` Returns a set with the names of all configurations contained in this combined configuration.
`double` `getDouble(String key)` Get a double associated with the given configuration key.
`double` `getDouble(String key, double defaultValue)` Get a double associated with the given configuration key.
`Double` `getDouble(String key, Double defaultValue)` Get a `Double` associated with the given configuration key.
`Collection<ConfigurationErrorListener>` `getErrorListeners()` Returns a collection with all configuration error listeners that are currently registered at this object.
`ExpressionEngine` `getExpressionEngine()` Returns the expression engine used by this configuration.
`float` `getFloat(String key)` Get a float associated with the given configuration key.
`float` `getFloat(String key, float defaultValue)` Get a float associated with the given configuration key.
`Float` `getFloat(String key, Float defaultValue)` Get a `Float` associated with the given configuration key.
`int` `getInt(String key)` Get a int associated with the given configuration key.
`int` `getInt(String key, int defaultValue)` Get a int associated with the given configuration key.
`Integer` `getInteger(String key, Integer defaultValue)` Get an `Integer` associated with the given configuration key.
`String` `getKeyPattern()`
`Iterator<String>` `getKeys()` Returns an iterator with all keys defined in this configuration.
`Iterator<String>` `getKeys(String prefix)` Returns an iterator with all keys defined in this configuration that start with the given prefix.
`List<Object>` `getList(String key)` Get a List of strings associated with the given configuration key.
`List<Object>` `getList(String key, List<Object> defaultValue)` Get a List of strings associated with the given configuration key.
`long` `getLong(String key)` Get a long associated with the given configuration key.
`long` `getLong(String key, long defaultValue)` Get a long associated with the given configuration key.
`Long` `getLong(String key, Long defaultValue)` Get a `Long` associated with the given configuration key.
`int` `getMaxIndex(String key)` Returns the maximum defined index for the given key.
`NodeCombiner` `getNodeCombiner()` Returns the node combiner that is used for creating the combined node structure.
`int` `getNumberOfConfigurations()` Returns the number of configurations that are contained in this combined configuration.
`Properties` `getProperties(String key)` Get a list of properties associated with the given configuration key.
`Object` `getProperty(String key)` Fetches the specified property.
`HierarchicalConfiguration.Node` `getRoot()` Returns the root node of this hierarchical configuration.
`ConfigurationNode` `getRootNode()` Returns the configuration root node of this combined configuration.
`short` `getShort(String key)` Get a short associated with the given configuration key.
`short` `getShort(String key, short defaultValue)` Get a short associated with the given configuration key.
`Short` `getShort(String key, Short defaultValue)` Get a `Short` associated with the given configuration key.
`Configuration` `getSource(String key)` Returns the configuration source, in which the specified key is defined.
`String` `getString(String key)` Get a string associated with the given configuration key.
`String` `getString(String key, String defaultValue)` Get a string associated with the given configuration key.
`String[]` `getStringArray(String key)` Get an array of strings associated with the given configuration key.
`Configuration` `interpolatedConfiguration()` Returns a configuration with the same content as this configuration, but with all variables replaced by their actual values.
`void` `invalidate()` Invalidates the current combined configuration.
`void` `invalidateAll()`
`boolean` `isEmpty()` Checks if this configuration is empty.
`boolean` `removeConfiguration(Configuration config)` Removes the specified configuration from this combined configuration.
`Configuration` `removeConfiguration(String name)` Removes the configuration with the specified name.
`Configuration` `removeConfigurationAt(int index)` Removes the configuration at the specified index.
`boolean` `removeConfigurationListener(ConfigurationListener l)` Removes the specified event listener so that it does not receive any further events caused by this object.
`boolean` `removeErrorListener(ConfigurationErrorListener l)` Removes the specified error listener so that it does not receive any further events caused by this object.
`protected Object` `resolveContainerStore(String key)` Returns an object from the store described by the key.
`void` `setExpressionEngine(ExpressionEngine expressionEngine)` Sets the expression engine to be used by this configuration.
`void` `setKeyPattern(String pattern)`
`void` `setLoggerName(String name)` Set the name of the Logger to use on each CombinedConfiguration.
`void` `setNodeCombiner(NodeCombiner nodeCombiner)` Sets the node combiner.
`void` `setProperty(String key, Object value)` Sets the value of the specified property.
`void` `setRoot(HierarchicalConfiguration.Node node)` Sets the root node of this hierarchical configuration.
`void` `setRootNode(ConfigurationNode rootNode)` Sets the root node of this hierarchical configuration.
`Configuration` `subset(String prefix)` Creates a new `Configuration` object containing all keys that start with the specified prefix.

Methods inherited from class org.apache.commons.configuration.CombinedConfiguration
`addConfiguration, addConfiguration, configurationChanged, fetchNodeList, getConfigurationNameList, getConfigurations, getConversionExpressionEngine, isForceReloadCheck, isIgnoreReloadExceptions, performReloadCheck, setConversionExpressionEngine, setForceReloadCheck, setIgnoreReloadExceptions`

Methods inherited from class org.apache.commons.configuration.HierarchicalReloadableConfiguration
`getReloadLock`

Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration
`addPropertyDirect, clearNode, clearNode, clearReferences, createAddPath, createNode, createSubnodeConfiguration, createSubnodeConfiguration, fetchAddNode, findLastPathNode, findPropertyNodes, getDefaultExpressionEngine, nodeDefined, nodeDefined, removeNode, removeNode, setDefaultExpressionEngine, subnodeConfigurationChanged`

Methods inherited from class org.apache.commons.configuration.AbstractConfiguration

`addErrorLogListener, append, clearPropertyDirect, copy, createInterpolator, getDefaultListDelimiter, getDelimiter, getInterpolator, getListDelimiter, getLogger, getProperties, getSubstitutor, interpolate, interpolate, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing`

Methods inherited from class org.apache.commons.configuration.event.EventSource
`createErrorEvent, createEvent, fireError, fireEvent, isDetailEvents, setDetailEvents`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DynamicCombinedConfiguration

    public DynamicCombinedConfiguration(NodeCombiner comb)

  Creates a new instance of `DynamicCombinedConfiguration` and initializes the combiner to be used.

  Parameters:
    `comb` - the node combiner (can be null, then a union combiner is used as default)

### DynamicCombinedConfiguration

    public DynamicCombinedConfiguration()

  Creates a new instance of `DynamicCombinedConfiguration` that uses a union combiner.

  See Also:
    `UnionCombiner`

Method Detail

### setKeyPattern

    public void setKeyPattern(String pattern)

### getKeyPattern

    public String getKeyPattern()

### setLoggerName

    public void setLoggerName(String name)

  Set the name of the Logger to use on each CombinedConfiguration.

  Parameters:
    `name` - The Logger name.

### getNodeCombiner

    public NodeCombiner getNodeCombiner()

  Returns the node combiner that is used for creating the combined node structure.

  Overrides:
    `getNodeCombiner` in class `CombinedConfiguration`
  Returns:
    the node combiner

### setNodeCombiner

    public void setNodeCombiner(NodeCombiner nodeCombiner)

  Sets the node combiner. This object will be used when the combined node structure is to be constructed. It must not be null, otherwise an `IllegalArgumentException` exception is thrown. Changing the node combiner causes an invalidation of this combined configuration, so that the new combiner immediately takes effect.

  Overrides:
    `setNodeCombiner` in class `CombinedConfiguration`
  Parameters:
    `nodeCombiner` - the node combiner

### addConfiguration

    public void addConfiguration(AbstractConfiguration config,
                                 String name,
                                 String at)

  Adds a new configuration to this combined configuration. It is possible (but not mandatory) to give the new configuration a name. This name must be unique, otherwise a `ConfigurationRuntimeException` will be thrown. With the optional `at` argument you can specify where in the resulting node structure the content of the added configuration should appear. This is a string that uses dots as property delimiters (independent on the current expression engine). For instance if you pass in the string `"database.tables"`, all properties of the added configuration will occur in this branch.

  Overrides:
    `addConfiguration` in class `CombinedConfiguration`
  Parameters:
    `config` - the configuration to add (must not be null)
    `name` - the name of this configuration (can be null)
    `at` - the position of this configuration in the combined tree (can be null)

### getNumberOfConfigurations

    public int getNumberOfConfigurations()

  Returns the number of configurations that are contained in this combined configuration.

  Overrides:
    `getNumberOfConfigurations` in class `CombinedConfiguration`
  Returns:
    the number of contained configurations

### getConfiguration

    public Configuration getConfiguration(int index)

  Returns the configuration at the specified index. The contained configurations are numbered in the order they were added to this combined configuration. The index of the first configuration is 0.

  Overrides:
    `getConfiguration` in class `CombinedConfiguration`
  Parameters:
    `index` - the index
  Returns:
    the configuration at this index

### getConfiguration

    public Configuration getConfiguration(String name)

  Returns the configuration with the given name. This can be null if no such configuration exists.

  Overrides:
    `getConfiguration` in class `CombinedConfiguration`
  Parameters:
    `name` - the name of the configuration
  Returns:
    the configuration with this name

### getConfigurationNames

    public Set<String> getConfigurationNames()

  Returns a set with the names of all configurations contained in this combined configuration. Of course here are only these configurations listed, for which a name was specified when they were added.

  Overrides:
    `getConfigurationNames` in class `CombinedConfiguration`
  Returns:
    a set with the names of the contained configurations (never null)

### removeConfiguration

    public Configuration removeConfiguration(String name)

  Removes the configuration with the specified name.

  Overrides:
    `removeConfiguration` in class `CombinedConfiguration`
  Parameters:
    `name` - the name of the configuration to be removed
  Returns:
    the removed configuration (null if this configuration was not found)

### removeConfiguration

    public boolean removeConfiguration(Configuration config)

  Removes the specified configuration from this combined configuration.

  Overrides:
    `removeConfiguration` in class `CombinedConfiguration`
  Parameters:
    `config` - the configuration to be removed
  Returns:
    a flag whether this configuration was found and could be removed

### removeConfigurationAt

    public Configuration removeConfigurationAt(int index)

  Removes the configuration at the specified index.

  Overrides:
    `removeConfigurationAt` in class `CombinedConfiguration`
  Parameters:
    `index` - the index
  Returns:
    the removed configuration

### getRootNode

    public ConfigurationNode getRootNode()

  Returns the configuration root node of this combined configuration. This method will construct a combined node structure using the current node combiner if necessary.

  Overrides:
    `getRootNode` in class `CombinedConfiguration`
  Returns:
    the combined root node

### setRootNode

    public void setRootNode(ConfigurationNode rootNode)

  Description copied from class: `HierarchicalConfiguration`
  Sets the root node of this hierarchical configuration.

  Overrides:
    `setRootNode` in class `HierarchicalConfiguration`
  Parameters:
    `rootNode` - the root node

### addProperty

    public void addProperty(String key,
                            Object value)

  Description copied from interface: `Configuration`
  Add 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 call

      addProperty("resource.loader", "classpath")

  Then you will end up with a List like the following:

      ["file", "classpath"]

  Specified by:
    `addProperty` in interface `Configuration`
  Overrides:
    `addProperty` in class `AbstractConfiguration`
  Parameters:
    `key` - The key to add the property to.
    `value` - The value to add.

### clear

    public void clear()

  Description copied from class: `CombinedConfiguration`
  Clears this configuration. All contained configurations will be removed.

  Specified by:
    `clear` in interface `Configuration`
  Overrides:
    `clear` in class `CombinedConfiguration`

### clearProperty

    public void clearProperty(String key)

  Description copied from class: `HierarchicalConfiguration`
  Removes the property with the given key. Properties with names that start with the given key (i.e. properties below the specified key in the hierarchy) won't be affected.

  Specified by:
    `clearProperty` in interface `Configuration`
  Overrides:
    `clearProperty` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key of the property to be removed

### containsKey

    public boolean containsKey(String key)

  Description copied from class: `HierarchicalConfiguration`
  Checks if the specified key is contained in this configuration. Note that for this configuration the term "contained" means that the key has an associated value. If there is a node for this key that has no value but children (either defined or undefined), this method will still return false .

  Specified by:
    `containsKey` in interface `Configuration`
  Overrides:
    `containsKey` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key to be chekced
  Returns:
    a flag if this key is contained in this configuration

### getBigDecimal

    public BigDecimal getBigDecimal(String key,
                                    BigDecimal defaultValue)

  Description copied from interface: `Configuration`
  Get a `BigDecimal` associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.

  Specified by:
    `getBigDecimal` in interface `Configuration`
  Overrides:
    `getBigDecimal` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated BigDecimal if key is found and has valid format, default value otherwise.

### getBigDecimal

    public BigDecimal getBigDecimal(String key)

  Description copied from class: `AbstractConfiguration`
  Get a `BigDecimal` associated with the given configuration key.

  Specified by:
    `getBigDecimal` in interface `Configuration`
  Overrides:
    `getBigDecimal` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated BigDecimal if key is found and has valid format
  See Also:
    `AbstractConfiguration.setThrowExceptionOnMissing(boolean)`

### getBigInteger

    public BigInteger getBigInteger(String key,
                                    BigInteger defaultValue)

  Description copied from interface: `Configuration`
  Get a `BigInteger` associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.

  Specified by:
    `getBigInteger` in interface `Configuration`
  Overrides:
    `getBigInteger` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated BigInteger if key is found and has valid format, default value otherwise.

### getBigInteger

    public BigInteger getBigInteger(String key)

  Description copied from class: `AbstractConfiguration`
  Get a `BigInteger` associated with the given configuration key.

  Specified by:
    `getBigInteger` in interface `Configuration`
  Overrides:
    `getBigInteger` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated BigInteger if key is found and has valid format
  See Also:
    `AbstractConfiguration.setThrowExceptionOnMissing(boolean)`

### getBoolean

    public boolean getBoolean(String key,
                              boolean defaultValue)

  Description copied from class: `AbstractConfiguration`
  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:
    `getBoolean` in interface `Configuration`
  Overrides:
    `getBoolean` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated boolean.
  See Also:
    `PropertyConverter.toBoolean(Object)`

### getBoolean

    public Boolean getBoolean(String key,
                              Boolean defaultValue)

  Description copied from class: `AbstractConfiguration`
  Obtains the value of the specified key and tries to convert it into a `Boolean` object. If the property has no value, the passed in default value will be used.

  Specified by:
    `getBoolean` in interface `Configuration`
  Overrides:
    `getBoolean` in class `AbstractConfiguration`
  Parameters:
    `key` - the key of the property
    `defaultValue` - the default value
  Returns:
    the value of this key converted to a `Boolean`
  See Also:
    `PropertyConverter.toBoolean(Object)`

### getBoolean

    public boolean getBoolean(String key)

  Description copied from class: `AbstractConfiguration`
  Get a boolean associated with the given configuration key.

  Specified by:
    `getBoolean` in interface `Configuration`
  Overrides:
    `getBoolean` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated boolean.
  See Also:
    `PropertyConverter.toBoolean(Object)`

### getByte

    public byte getByte(String key,
                        byte defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getByte` in interface `Configuration`
  Overrides:
    `getByte` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated byte.

### getByte

    public Byte getByte(String key,
                        Byte defaultValue)

  Description copied from interface: `Configuration`
  Get a `Byte` associated with the given configuration key.

  Specified by:
    `getByte` in interface `Configuration`
  Overrides:
    `getByte` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated byte if key is found and has valid format, default value otherwise.

### getByte

    public byte getByte(String key)

  Description copied from interface: `Configuration`
  Get a byte associated with the given configuration key.

  Specified by:
    `getByte` in interface `Configuration`
  Overrides:
    `getByte` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated byte.

### getDouble

    public double getDouble(String key,
                            double defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getDouble` in interface `Configuration`
  Overrides:
    `getDouble` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated double.

### getDouble

    public Double getDouble(String key,
                            Double defaultValue)

  Description copied from interface: `Configuration`
  Get a `Double` associated with the given configuration key.

  Specified by:
    `getDouble` in interface `Configuration`
  Overrides:
    `getDouble` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated double if key is found and has valid format, default value otherwise.

### getDouble

    public double getDouble(String key)

  Description copied from interface: `Configuration`
  Get a double associated with the given configuration key.

  Specified by:
    `getDouble` in interface `Configuration`
  Overrides:
    `getDouble` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated double.

### getFloat

    public float getFloat(String key,
                          float defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getFloat` in interface `Configuration`
  Overrides:
    `getFloat` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated float.

### getFloat

    public Float getFloat(String key,
                          Float defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getFloat` in interface `Configuration`
  Overrides:
    `getFloat` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated float if key is found and has valid format, default value otherwise.

### getFloat

    public float getFloat(String key)

  Description copied from interface: `Configuration`
  Get a float associated with the given configuration key.

  Specified by:
    `getFloat` in interface `Configuration`
  Overrides:
    `getFloat` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated float.

### getInt

    public int getInt(String key,
                      int defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getInt` in interface `Configuration`
  Overrides:
    `getInt` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated int.

### getInt

    public int getInt(String key)

  Description copied from interface: `Configuration`
  Get a int associated with the given configuration key.

  Specified by:
    `getInt` in interface `Configuration`
  Overrides:
    `getInt` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated int.

### getInteger

    public Integer getInteger(String key,
                              Integer defaultValue)

  Description copied from interface: `Configuration`
  Get an `Integer` associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.

  Specified by:
    `getInteger` in interface `Configuration`
  Overrides:
    `getInteger` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated int if key is found and has valid format, default value otherwise.

### getKeys

    public Iterator<String> getKeys()

  Description copied from class: `HierarchicalConfiguration`
  Returns an iterator with all keys defined in this configuration. Note that the keys returned by this method will not contain any indices. This means that some structure will be lost.

  Specified by:
    `getKeys` in interface `Configuration`
  Overrides:
    `getKeys` in class `HierarchicalConfiguration`
  Returns:
    an iterator with the defined keys in this configuration

### getKeys

    public Iterator<String> getKeys(String prefix)

  Description copied from class: `HierarchicalConfiguration`
  Returns an iterator with all keys defined in this configuration that start with the given prefix. The returned keys will not contain any indices. This implementation tries to locate a node whose key is the same as the passed in prefix. Then the subtree of this node is traversed, and the keys of all nodes encountered (including attributes) are added to the result set.

  Specified by:
    `getKeys` in interface `Configuration`
  Overrides:
    `getKeys` in class `HierarchicalConfiguration`
  Parameters:
    `prefix` - the prefix of the keys to start with
  Returns:
    an iterator with the found keys
  See Also:
    `Configuration.getKeys()`

### getList

    public List<Object> getList(String key,
                                List<Object> defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getList` in interface `Configuration`
  Overrides:
    `getList` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated List of strings.

### getList

    public List<Object> getList(String key)

  Description copied from class: `AbstractConfiguration`
  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:
    `getList` in interface `Configuration`
  Overrides:
    `getList` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated List.
  See Also:
    `AbstractConfiguration.getStringArray(String)`

### getLong

    public long getLong(String key,
                        long defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getLong` in interface `Configuration`
  Overrides:
    `getLong` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated long.

### getLong

    public Long getLong(String key,
                        Long defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getLong` in interface `Configuration`
  Overrides:
    `getLong` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated long if key is found and has valid format, default value otherwise.

### getLong

    public long getLong(String key)

  Description copied from interface: `Configuration`
  Get a long associated with the given configuration key.

  Specified by:
    `getLong` in interface `Configuration`
  Overrides:
    `getLong` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated long.

### getProperties

    public Properties getProperties(String key)

  Description copied from interface: `Configuration`
  Get 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 returned `Properties` object, the value parts become values.

  Specified by:
    `getProperties` in interface `Configuration`
  Overrides:
    `getProperties` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated properties if key is found.

### getProperty

    public Object getProperty(String key)

  Description copied from class: `HierarchicalConfiguration`
  Fetches the specified property. This task is delegated to the associated expression engine.

  Specified by:
    `getProperty` in interface `Configuration`
  Overrides:
    `getProperty` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key to be looked up
  Returns:
    the found value

### getShort

    public short getShort(String key,
                          short defaultValue)

  Description copied from interface: `Configuration`
  Get a short associated with the given configuration key.

  Specified by:
    `getShort` in interface `Configuration`
  Overrides:
    `getShort` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated short.

### getShort

    public Short getShort(String key,
                          Short defaultValue)

  Description copied from interface: `Configuration`
  Get a `Short` associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.

  Specified by:
    `getShort` in interface `Configuration`
  Overrides:
    `getShort` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated short if key is found and has valid format, default value otherwise.

### getShort

    public short getShort(String key)

  Description copied from interface: `Configuration`
  Get a short associated with the given configuration key.

  Specified by:
    `getShort` in interface `Configuration`
  Overrides:
    `getShort` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated short.

### getString

    public String getString(String key,
                            String defaultValue)

  Description copied from interface: `Configuration`
  Get 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:
    `getString` in interface `Configuration`
  Overrides:
    `getString` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
    `defaultValue` - The default value.
  Returns:
    The associated string if key is found and has valid format, default value otherwise.

### getString

    public String getString(String key)

  Description copied from class: `AbstractConfiguration`
  Get a string associated with the given configuration key.

  Specified by:
    `getString` in interface `Configuration`
  Overrides:
    `getString` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated string.
  See Also:
    `AbstractConfiguration.setThrowExceptionOnMissing(boolean)`

### getStringArray

    public String[] getStringArray(String key)

  Description copied from class: `AbstractConfiguration`
  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 the `setListDelimiter()` method. If this is the case, the string is split at these positions resulting in a property with multiple values.

  Specified by:
    `getStringArray` in interface `Configuration`
  Overrides:
    `getStringArray` in class `AbstractConfiguration`
  Parameters:
    `key` - The configuration key.
  Returns:
    The associated string array if key is found.
  See Also:
    `AbstractConfiguration.setListDelimiter(char)`, `AbstractConfiguration.setDelimiterParsingDisabled(boolean)`

### isEmpty

    public boolean isEmpty()

  Description copied from class: `HierarchicalConfiguration`
  Checks if this configuration is empty. Empty means that there are no keys with any values, though there can be some (empty) nodes.

  Specified by:
    `isEmpty` in interface `Configuration`
  Overrides:
    `isEmpty` in class `HierarchicalConfiguration`
  Returns:
    a flag if this configuration is empty

### setProperty

    public void setProperty(String key,
                            Object value)

  Description copied from class: `HierarchicalConfiguration`
  Sets the value of the specified property.

  Specified by:
    `setProperty` in interface `Configuration`
  Overrides:
    `setProperty` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key of the property to set
    `value` - the new value of this property

### subset

    public Configuration subset(String prefix)

  Description copied from class: `HierarchicalConfiguration`
  Creates a new `Configuration` object containing all keys that start with the specified prefix. This implementation will return a `HierarchicalConfiguration` object so that the structure of the keys will be saved. The nodes selected by the prefix (it is possible that multiple nodes are selected) are mapped to the root node of the returned configuration, i.e. their children and attributes will become children and attributes of the new root node. However a value of the root node is only set if exactly one of the selected nodes contain a value (if multiple nodes have a value, there is simply no way to decide how these values are merged together). Note that the returned `Configuration` object is not connected to its source configuration: updates on the source configuration are not reflected in the subset and vice versa.

  Specified by:
    `subset` in interface `Configuration`
  Overrides:
    `subset` in class `HierarchicalConfiguration`
  Parameters:
    `prefix` - the prefix of the keys for the subset
  Returns:
    a new configuration object representing the selected subset
  See Also:
    `SubsetConfiguration`

### getRoot

    public HierarchicalConfiguration.Node getRoot()

  Description copied from class: `HierarchicalConfiguration`
  Returns the root node of this hierarchical configuration. This method exists for backwards compatibility only. New code should use the `HierarchicalConfiguration.getRootNode()` method instead, which operates on the preferred data type `ConfigurationNode`.

  Overrides:
    `getRoot` in class `HierarchicalConfiguration`
  Returns:
    the root node

### setRoot

    public void setRoot(HierarchicalConfiguration.Node node)

  Description copied from class: `HierarchicalConfiguration`
  Sets the root node of this hierarchical configuration. This method exists for backwards compatibility only. New code should use the `HierarchicalConfiguration.setRootNode(ConfigurationNode)` method instead, which operates on the preferred data type `ConfigurationNode`.

  Overrides:
    `setRoot` in class `HierarchicalConfiguration`
  Parameters:
    `node` - the root node

### getExpressionEngine

    public ExpressionEngine getExpressionEngine()

  Description copied from class: `HierarchicalConfiguration`
  Returns the expression engine used by this configuration. This method will never return null; if no specific expression engine was set, the default expression engine will be returned.

  Overrides:
    `getExpressionEngine` in class `HierarchicalConfiguration`
  Returns:
    the current expression engine

### setExpressionEngine

    public void setExpressionEngine(ExpressionEngine expressionEngine)

  Description copied from class: `HierarchicalConfiguration`
  Sets the expression engine to be used by this configuration. All property keys this configuration has to deal with will be interpreted by this engine.

  Overrides:
    `setExpressionEngine` in class `HierarchicalConfiguration`
  Parameters:
    `expressionEngine` - the new expression engine; can be null, then the default expression engine will be used

### addNodes

    public void addNodes(String key,
                         Collection<? extends ConfigurationNode> nodes)

  Description copied from class: `HierarchicalConfiguration`
  Adds a collection of nodes at the specified position of the configuration tree. This method works similar to `addProperty()`, but instead of a single property a whole collection of nodes can be added - and thus complete configuration sub trees. E.g. with this method it is possible to add parts of another `HierarchicalConfiguration` object to this object. (However be aware that a `ConfigurationNode` object can only belong to a single configuration. So if nodes from one configuration are directly added to another one using this method, the structure of the source configuration will be broken. In this case you should clone the nodes to be added before calling `addNodes()`.) If the passed in key refers to an existing and unique node, the new nodes are added to this node. Otherwise a new node will be created at the specified position in the hierarchy.

  Overrides:
    `addNodes` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key where the nodes are to be added; can be null , then they are added to the root node
    `nodes` - a collection with the `Node` objects to be added

### configurationAt

    public SubnodeConfiguration configurationAt(String key,
                                                boolean supportUpdates)

  Description copied from class: `HierarchicalConfiguration`

  Returns a hierarchical subnode configuration object that wraps the configuration node specified by the given key. This method provides an easy means of accessing sub trees of a hierarchical configuration. In the returned configuration the sub tree can directly be accessed, it becomes the root node of this configuration. Because of this the passed in key must select exactly one configuration node; otherwise an `IllegalArgumentException` will be thrown.

  The difference between this method and the `HierarchicalConfiguration.subset(String)` method is that `subset()` supports arbitrary subsets of configuration nodes while `configurationAt()` only returns a single sub tree. Please refer to the documentation of the `SubnodeConfiguration` class to obtain further information about subnode configurations and when they should be used.

  With the `supportUpdate` flag the behavior of the returned `SubnodeConfiguration` regarding updates of its parent configuration can be determined. A subnode configuration operates on the same nodes as its parent, so changes at one configuration are normally directly visible for the other configuration. There are however changes of the parent configuration, which are not recognized by the subnode configuration per default. An example for this is a reload operation (for file-based configurations): Here the complete node set of the parent configuration is replaced, but the subnode configuration still references the old nodes. If such changes should be detected by the subnode configuration, the `supportUpdates` flag must be set to true. This causes the subnode configuration to reevaluate the key used for its creation each time it is accessed. This guarantees that the subnode configuration always stays in sync with its key, even if the parent configuration's data significantly changes. If such a change makes the key invalid - because it now no longer points to exactly one node -, the subnode configuration is not reconstructed, but keeps its old data. It is then quasi detached from its parent.

  Overrides:
    `configurationAt` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key that selects the sub tree
    `supportUpdates` - a flag whether the returned subnode configuration should be able to handle updates of its parent
  Returns:
    a hierarchical configuration that contains this sub tree
  See Also:
    `SubnodeConfiguration`

### configurationAt

    public SubnodeConfiguration configurationAt(String key)

  Description copied from class: `HierarchicalConfiguration`
  Returns a hierarchical subnode configuration for the node specified by the given key. This is a short form for `configurationAt(key, <b>false</b>)`.

  Overrides:
    `configurationAt` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key that selects the sub tree
  Returns:
    a hierarchical configuration that contains this sub tree
  See Also:
    `SubnodeConfiguration`

### configurationsAt

    public List<HierarchicalConfiguration> configurationsAt(String key)

  Description copied from class: `HierarchicalConfiguration`
  Returns a list of sub configurations for all configuration nodes selected by the given key. This method will evaluate the passed in key (using the current `ExpressionEngine`) and then create a subnode configuration for each returned node (like `HierarchicalConfiguration.configurationAt(String)`}). This is especially useful when dealing with list-like structures. As an example consider the configuration that contains data about database tables and their fields. If you need access to all fields of a certain table, you can simply do

       List fields = config.configurationsAt("tables.table(0).fields.field");
       for(Iterator it = fields.iterator(); it.hasNext();)
       {
           HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next();
           // now the children and attributes of the field node can be
           // directly accessed
           String fieldName = sub.getString("name");
           String fieldType = sub.getString("type");
           ...

  Overrides:
    `configurationsAt` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key for selecting the desired nodes
  Returns:
    a list with hierarchical configuration objects; each configuration represents one of the nodes selected by the passed in key

### clearTree

    public void clearTree(String key)

  Description copied from class: `HierarchicalConfiguration`
  Removes all values of the property with the given name and of keys that start with this name. So if there is a property with the key "foo" and a property with the key "foo.bar", a call of `clearTree("foo")` would remove both properties.

  Overrides:
    `clearTree` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key of the property to be removed

### getMaxIndex

    public int getMaxIndex(String key)

  Description copied from class: `HierarchicalConfiguration`
  Returns the maximum defined index for the given key. This is useful if there are multiple values for this key. They can then be addressed separately by specifying indices from 0 to the return value of this method.

  Overrides:
    `getMaxIndex` in class `HierarchicalConfiguration`
  Parameters:
    `key` - the key to be checked
  Returns:
    the maximum defined index for this key

### interpolatedConfiguration

    public Configuration interpolatedConfiguration()

  Description copied from class: `HierarchicalConfiguration`
  Returns a configuration with the same content as this configuration, but with all variables replaced by their actual values. This implementation is specific for hierarchical configurations. It clones the current configuration and runs a specialized visitor on the clone, which performs interpolation on the single configuration nodes.

  Overrides:
    `interpolatedConfiguration` in class `HierarchicalConfiguration`
  Returns:
    a configuration with all variables interpolated

### getSource

    public Configuration getSource(String key)

  Returns the configuration source, in which the specified key is defined. This method will determine the configuration node that is identified by the given key. The following constellations are possible:
  - If no node object is found for this key, null is returned.
  - If the key maps to multiple nodes belonging to different configuration sources, a `IllegalArgumentException` is thrown (in this case no unique source can be determined).
  - If exactly one node is found for the key, the (child) configuration object, to which the node belongs is determined and returned.
  - For keys that have been added directly to this combined configuration and that do not belong to the namespaces defined by existing child configurations this configuration will be returned.

  Overrides:
    `getSource` in class `CombinedConfiguration`
  Parameters:
    `key` - the key of a configuration property
  Returns:
    the configuration, to which this property belongs or null if the key cannot be resolved
  Throws:
    `IllegalArgumentException` - if the key maps to multiple properties and the source cannot be determined, or if the key is null

### addConfigurationListener

    public void addConfigurationListener(ConfigurationListener l)

  Description copied from class: `EventSource`
  Adds a configuration listener to this object.

  Overrides:
    `addConfigurationListener` in class `EventSource`
  Parameters:
    `l` - the listener to add

### removeConfigurationListener

    public boolean removeConfigurationListener(ConfigurationListener l)

  Description copied from class: `EventSource`
  Removes the specified event listener so that it does not receive any further events caused by this object.

  Overrides:
    `removeConfigurationListener` in class `EventSource`
  Parameters:
    `l` - the listener to be removed
  Returns:
    a flag whether the event listener was found

### getConfigurationListeners

    public Collection<ConfigurationListener> getConfigurationListeners()

  Description copied from class: `EventSource`
  Returns a collection with all configuration event listeners that are currently registered at this object.

  Overrides:
    `getConfigurationListeners` in class `EventSource`
  Returns:
    a collection with the registered `ConfigurationListener`s (this collection is a snapshot of the currently registered listeners; manipulating it has no effect on this event source object)

### clearConfigurationListeners

    public void clearConfigurationListeners()

  Description copied from class: `EventSource`
  Removes all registered configuration listeners.

  Overrides:
    `clearConfigurationListeners` in class `EventSource`

### addErrorListener

    public void addErrorListener(ConfigurationErrorListener l)

  Description copied from class: `EventSource`
  Adds a new configuration error listener to this object. This listener will then be notified about internal problems.

  Overrides:
    `addErrorListener` in class `EventSource`
  Parameters:
    `l` - the listener to register (must not be null)

### removeErrorListener

    public boolean removeErrorListener(ConfigurationErrorListener l)

  Description copied from class: `EventSource`
  Removes the specified error listener so that it does not receive any further events caused by this object.

  Overrides:
    `removeErrorListener` in class `EventSource`
  Parameters:
    `l` - the listener to remove
  Returns:
    a flag whether the listener could be found and removed

### clearErrorListeners

    public void clearErrorListeners()

  Description copied from class: `EventSource`
  Removes all registered error listeners.

  Overrides:
    `clearErrorListeners` in class `EventSource`

### getErrorListeners

    public Collection<ConfigurationErrorListener> getErrorListeners()

  Description copied from class: `EventSource`
  Returns a collection with all configuration error listeners that are currently registered at this object.

  Overrides:
    `getErrorListeners` in class `EventSource`
  Returns:
    a collection with the registered `ConfigurationErrorListener`s (this collection is a snapshot of the currently registered listeners; it cannot be manipulated)

### clone

    public Object clone()

  Returns a copy of this object. This implementation performs a deep clone, i.e. all contained configurations will be cloned, too. For this to work, all contained configurations must be cloneable. Registered event listeners won't be cloned. The clone will use the same node combiner than the original.

  Overrides:
    `clone` in class `CombinedConfiguration`
  Returns:
    the copied object

### invalidate

    public void invalidate()

  Invalidates the current combined configuration. This means that the next time a property is accessed the combined node structure must be re-constructed. Invalidation of a combined configuration also means that an event of type `EVENT_COMBINED_INVALIDATE` is fired. Note that while other events most times appear twice (once before and once after an update), this event is only fired once (after update).

  Overrides:
    `invalidate` in class `CombinedConfiguration`

### invalidateAll

    public void invalidateAll()

### resolveContainerStore

    protected Object resolveContainerStore(String key)

  Description copied from class: `AbstractConfiguration`
  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.

  Overrides:
    `resolveContainerStore` in class `AbstractConfiguration`
  Parameters:
    `key` - The property key.
  Returns:
    value Value, transparently resolving a possible collection dependency.

Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.