Class BaseConfiguration
java.lang.Object
org.apache.commons.configuration.event.EventSource
org.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.BaseConfiguration
- All Implemented Interfaces:
Cloneable, Configuration
- Direct Known Subclasses:
AbstractFileConfiguration
Basic configuration class. 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 1231721 2012-01-15 18:32:07Z 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
-
Field Summary
Fields inherited from class AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPropertyDirect(String key, Object value) Adds a key/value pair to the map.voidclear()Remove all properties from the configuration.protected voidClear a property in the configuration.clone()Creates a copy of this object.booleancontainsKey(String key) check if the configuration contains the keygetKeys()Get the list of the keys contained in the configuration repository.getProperty(String key) Read property from underlying map.booleanisEmpty()Check if the configuration is emptyMethods inherited from class 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, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setProperty, setThrowExceptionOnMissing, subsetMethods inherited from class EventSource
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents
-
Constructor Details
-
BaseConfiguration
public BaseConfiguration()
-
-
Method Details
-
addPropertyDirect
Adds a key/value pair to the map. This routine does no magic morphing. It ensures the keylist is maintained- Specified by:
addPropertyDirectin classAbstractConfiguration- Parameters:
key- key to use for mappingvalue- object to store
-
getProperty
Read property from underlying map.- Specified by:
getPropertyin interfaceConfiguration- Parameters:
key- key to use for mapping- Returns:
- object associated with the given configuration key.
-
isEmpty
Check if the configuration is empty- Specified by:
isEmptyin interfaceConfiguration- Returns:
trueif Configuration is empty,falseotherwise.
-
containsKey
check if the configuration contains the key- Specified by:
containsKeyin interfaceConfiguration- Parameters:
key- the configuration key- Returns:
trueif Configuration contain given key,falseotherwise.
-
clearPropertyDirect
Clear a property in the configuration.- Overrides:
clearPropertyDirectin classAbstractConfiguration- Parameters:
key- the key to remove along with corresponding value.
-
clear
Description copied from interface:ConfigurationRemove all properties from the configuration.- Specified by:
clearin interfaceConfiguration- Overrides:
clearin classAbstractConfiguration
-
getKeys
Get the list of the keys contained in the configuration repository.- Specified by:
getKeysin interfaceConfiguration- Returns:
- An Iterator.
-
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:
clonein classEventSource- Returns:
- the copy
- Since:
- 1.3
-