org.apache.commons.configuration
Class BaseConfiguration

java.lang.Object
  extended byorg.apache.commons.configuration.event.EventSource
      extended byorg.apache.commons.configuration.AbstractConfiguration
          extended byorg.apache.commons.configuration.BaseConfiguration
All Implemented Interfaces:
Cloneable, Configuration
Direct Known Subclasses:
AbstractFileConfiguration

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 529531 2007-04-17 08:52:41Z ebourg $
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
 
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
BaseConfiguration()
           
 
Method Summary
protected  void addPropertyDirect(String key, Object value)
          Adds a key/value pair to the map.
 void clear()
          Remove all properties from the configuration.
protected  void clearPropertyDirect(String key)
          Clear a property in the configuration.
 Object clone()
          Creates a copy of this object.
 boolean containsKey(String key)
          check if the configuration contains the key
 Iterator getKeys()
          Get the list of the keys contained in the configuration repository.
 Object getProperty(String key)
          Read property from underlying map.
 boolean isEmpty()
          Check if the configuration is empty
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addErrorLogListener, addProperty, append, 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
 

Constructor Detail

BaseConfiguration

public BaseConfiguration()
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

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

getProperty

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

Specified by:
getProperty in interface Configuration
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

Specified by:
isEmpty in interface Configuration
Returns:
true if Configuration is empty, false otherwise.

containsKey

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

Specified by:
containsKey in interface Configuration
Parameters:
key - the configuration key
Returns:
true if Configuration contain given key, false otherwise.

clearPropertyDirect

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

Overrides:
clearPropertyDirect in class AbstractConfiguration
Parameters:
key - the key to remove along with corresponding value.

clear

public void clear()
Description copied from interface: Configuration
Remove all properties from the configuration.

Specified by:
clear in interface Configuration
Overrides:
clear in class AbstractConfiguration

getKeys

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

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

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.

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


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