org.apache.commons.configuration
Class MapConfiguration

java.lang.Object
  |
  +--org.apache.commons.configuration.AbstractConfiguration
        |
        +--org.apache.commons.configuration.MapConfiguration
All Implemented Interfaces:
Configuration
Direct Known Subclasses:
SystemConfiguration

public class MapConfiguration
extends AbstractConfiguration

A Map based Configuration.

Since:
1.1
Version:
$Revision$, $Date: 2005-10-09 20:27:12 +0200 (Sun, 09 Oct 2005) $
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, 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.
 void clearProperty(String key)
          {@inheritDoc}
 boolean containsKey(String key)
          {@inheritDoc}
 Iterator getKeys()
          {@inheritDoc}
 Map getMap()
          Return the Map decorated by this configuration.
 Object getProperty(String key)
          Gets a property from the configuration.
 boolean isEmpty()
          {@inheritDoc}
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addProperty, clear, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolate, interpolateHelper, isThrowExceptionOnMissing, resolveContainerStore, setDelimiter, setProperty, setThrowExceptionOnMissing, subset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
Following copied from interface: org.apache.commons.configuration.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 acces to underlying Configuration store.
Overrides:
addPropertyDirect in class AbstractConfiguration
Following copied from class: org.apache.commons.configuration.AbstractConfiguration
Parameters:
key - key to use for mapping
value - object to store

isEmpty

public boolean isEmpty()
Description copied from class: AbstractConfiguration
{@inheritDoc}
Overrides:
isEmpty in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Returns:
true if the configuration contains no property, false otherwise.

containsKey

public boolean containsKey(String key)
Description copied from class: AbstractConfiguration
{@inheritDoc}
Overrides:
containsKey in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.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

clearProperty

public void clearProperty(String key)
Description copied from class: AbstractConfiguration
{@inheritDoc}
Overrides:
clearProperty in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Parameters:
key - the key to remove along with corresponding value.

getKeys

public Iterator getKeys()
Description copied from class: AbstractConfiguration
{@inheritDoc}
Overrides:
getKeys in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Returns:
An Iterator.


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