Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.configuration
Class MapConfiguration

    java.lang.Object
      org.apache.commons.configuration.event.EventSource
          org.apache.commons.configuration.AbstractConfiguration
              org.apache.commons.configuration.MapConfiguration

All Implemented Interfaces:
  Cloneable, Configuration

Direct Known Subclasses:
  SystemConfiguration

public class MapConfiguration
extends AbstractConfiguration
implements Cloneable

A Map based Configuration.

Note:Configuration objects of this type can be read concurrently by multiple threads. However if one of these threads modifies the object, synchronization has to be performed manually.

Since:
  1.1
Version:
  $Revision: 548098 $, $Date: 2007-06-17 21:34:03 +0200 (So, 17 Jun 2007) $
Author:
  Emmanuel Bourg

Field Summary
`protected Map` | `map` The Map decorated by this configuration.

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
`MapConfiguration(Map map)` Create a Configuration decorator around the specified Map.

Method Summary
`protected void` | `addPropertyDirect(String key, Object value)` Adds a key/value pair to the 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.
`Iterator` | `getKeys()` Get the list of the keys contained in the configuration.
`Map` | `getMap()` Return the Map decorated by this configuration.
`Object` | `getProperty(String key)` Gets a property from the configuration.
`boolean` | `isEmpty()` Check if the configuration is empty.

Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
`addErrorLogListener, addProperty, append, clear, 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, getKeys, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, 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`

Field Detail

### map

    protected Map map

  The Map decorated by this configuration.

Constructor Detail

### MapConfiguration

    public MapConfiguration(Map map)

  Create a Configuration decorator around the specified Map. The map is used to store the configuration properties, any change will also affect the Map.

Parameters:
  `map` - the map

Method Detail

### getMap

    public Map getMap()

  Return the Map decorated by this configuration.

  Returns:
    the map this configuration is based onto

### getProperty

    public Object getProperty(String key)

  Description copied from interface: `Configuration`
  Gets a property from the configuration. This is the most basic get method for retrieving values of properties. In a typical implementation of the `Configuration` interface the other get methods (that return specific data types) will internally make use of this method. On this level variable substitution is not yet performed. The returned object is an internal representation of the property value for the passed in key. It is owned by the `Configuration` object. So a caller should not modify this object. It cannot be guaranteed that this object will stay constant over time (i.e. further update operations on the configuration may change its internal state).

  Specified by:
    `getProperty` in interface `Configuration`
  Parameters:
    `key` - property to retrieve
  Returns:
    the value to which this configuration maps the specified key, or null if the configuration contains no mapping for this key.

### addPropertyDirect

    protected void addPropertyDirect(String key,
                                     Object value)

  Description copied from class: `AbstractConfiguration`
  Adds a key/value pair to the Configuration. Override this method to provide write access to underlying Configuration store.

  Specified by:
    `addPropertyDirect` in class `AbstractConfiguration`
  Parameters:
    `key` - key to use for mapping
    `value` - object to store

### isEmpty

    public boolean isEmpty()

  Description copied from interface: `Configuration`
  Check if the configuration is empty.

  Specified by:
    `isEmpty` in interface `Configuration`
  Returns:
    `true` if the configuration contains no property, `false` otherwise.

### containsKey

    public boolean containsKey(String key)

  Description copied from interface: `Configuration`
  Check if the configuration contains the specified key.

  Specified by:
    `containsKey` in interface `Configuration`
  Parameters:
    `key` - the key whose presence in this configuration is to be tested
  Returns:
    `true` if the configuration contains a value for this key, `false` otherwise

### clearPropertyDirect

    protected void clearPropertyDirect(String key)

  Description copied from class: `AbstractConfiguration`
  Removes the specified property from this configuration. This method is called by `clearProperty()` after it has done some preparations. It should be overriden in sub classes. This base implementation is just left empty.

  Overrides:
    `clearPropertyDirect` in class `AbstractConfiguration`
  Parameters:
    `key` - the key to be removed

### getKeys

    public Iterator getKeys()

  Description copied from interface: `Configuration`
  Get the list of the keys contained in the configuration. The returned iterator can be used to obtain all defined keys. Note that the exact behavior of the iterator's `remove()` 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.

  Specified by:
    `getKeys` in interface `Configuration`
  Returns:
    An Iterator.

### clone

    public Object clone()

  Returns a copy of this object. The returned configuration will contain the same properties as the original. Event listeners are not cloned.

  Overrides:
    `clone` in class `EventSource`
  Returns:
    the copy
  Since:
    1.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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