org.apache.commons.configuration

Class BaseConfiguration

public class BaseConfiguration extends AbstractConfiguration implements Cloneable

Basic configuration classe. Stores the configuration data but does not provide any load or save functions. If you want to load your Configuration from a file use PropertiesConfiguration or XmlConfiguration. This class extends normal Java properties by adding the possibility to use the same key many times concatenating the value strings instead of overwriting them.

Version: $Id: BaseConfiguration.java 495918 2007-01-13 16:33:02Z oheger $

Author: Stefano Mazzocchi Jon S. Stevens Dave Bryson Geir Magnusson Jr. Leon Messerschmidt Kent Johnson Daniel Rall Ilkka Priha Jason van Zyl Martin Poeschl Henning P. Schmiedehausen Konstantin Shaposhnikov Oliver Heger

Field Summary
Mapstore
stores the configuration key-value pairs
Method Summary
protected voidaddPropertyDirect(String key, Object value)
Adds a key/value pair to the map.
voidclear()
protected voidclearPropertyDirect(String key)
Clear a property in the configuration.
Objectclone()
Creates a copy of this object.
booleancontainsKey(String key)
check if the configuration contains the key
IteratorgetKeys()
Get the list of the keys contained in the configuration repository.
ObjectgetProperty(String key)
Read property from underlying map.
booleanisEmpty()
Check if the configuration is empty

Field Detail

store

private Map store
stores the configuration key-value pairs

Method Detail

addPropertyDirect

protected void addPropertyDirect(String key, Object value)
Adds a key/value pair to the map. This routine does no magic morphing. It ensures the keylist is maintained

Parameters: key key to use for mapping value object to store

clear

public void clear()
{@inheritDoc }

clearPropertyDirect

protected void clearPropertyDirect(String key)
Clear a property in the configuration.

Parameters: key the key to remove along with corresponding value.

clone

public Object clone()
Creates a copy of this object. This implementation will create a deep clone, i.e. the map that stores the properties is cloned, too. So changes performed at the copy won't affect the original and vice versa.

Returns: the copy

Since: 1.3

containsKey

public boolean containsKey(String key)
check if the configuration contains the key

Parameters: key the configuration key

Returns: true if Configuration contain given key, false otherwise.

getKeys

public Iterator getKeys()
Get the list of the keys contained in the configuration repository.

Returns: An Iterator.

getProperty

public Object getProperty(String key)
Read property from underlying map.

Parameters: key key to use for mapping

Returns: object associated with the given configuration key.

isEmpty

public boolean isEmpty()
Check if the configuration is empty

Returns: true if Configuration is empty, false otherwise.