Class PatternSubtreeConfigurationWrapper
- All Implemented Interfaces:
Serializable, Cloneable, Configuration, ConfigurationErrorListener, ConfigurationListener, FileConfiguration, FileSystemBased, Reloadable
- Since:
- 1.6
- Version:
- $Id: PatternSubtreeConfigurationWrapper.java 1534064 2013-10-21 08:44:33Z henning $
- Author:
- Commons Configuration team
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractHierarchicalFileConfiguration
AbstractHierarchicalFileConfiguration.FileConfigurationDelegateNested classes/interfaces inherited from class HierarchicalConfiguration
HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor -
Field Summary
Fields inherited from class HierarchicalConfiguration
EVENT_ADD_NODES, EVENT_CLEAR_TREE, EVENT_SUBNODE_CHANGEDFields inherited from class AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN -
Constructor Summary
ConstructorsConstructorDescriptionConstructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a configuration listener to this object.voidAdds a new configuration error listener to this object.voidaddNodes(String key, Collection<? extends ConfigurationNode> nodes) Directly adds sub nodes to this configuration.voidaddProperty(String key, Object value) Add a property to the configuration.voidclear()Clears this configuration.voidRemoves all registered configuration listeners.voidRemoves all registered error listeners.voidclearProperty(String key) Removes the property with the given key.voidRemoves all values of the property with the given name and of keys that start with this name.configurationAt(String key) Returns a hierarchical subnode configuration for the node specified by the given key.configurationAt(String key, boolean supportUpdates) Returns a hierarchical subnode configuration object that wraps the configuration node specified by the given key.configurationsAt(String key) Returns a list of sub configurations for all configuration nodes selected by the given key.booleancontainsKey(String key) Checks if the specified key is contained in this configuration.getBigDecimal(String key) Get aBigDecimalassociated with the given configuration key.getBigDecimal(String key, BigDecimal defaultValue) Get aBigDecimalassociated with the given configuration key.getBigInteger(String key) Get aBigIntegerassociated with the given configuration key.getBigInteger(String key, BigInteger defaultValue) Get aBigIntegerassociated with the given configuration key.booleangetBoolean(String key) Get a boolean associated with the given configuration key.booleangetBoolean(String key, boolean defaultValue) Get a boolean associated with the given configuration key.getBoolean(String key, Boolean defaultValue) Obtains the value of the specified key and tries to convert it into aBooleanobject.byteGet a byte associated with the given configuration key.byteGet a byte associated with the given configuration key.Get aByteassociated with the given configuration key.Returns a collection with all configuration event listeners that are currently registered at this object.doubleGet a double associated with the given configuration key.doubleGet a double associated with the given configuration key.Get aDoubleassociated with the given configuration key.Returns a collection with all configuration error listeners that are currently registered at this object.Returns the expression engine used by this configuration.floatGet a float associated with the given configuration key.floatGet a float associated with the given configuration key.Get aFloatassociated with the given configuration key.intGet a int associated with the given configuration key.intGet a int associated with the given configuration key.getInteger(String key, Integer defaultValue) Get anIntegerassociated with the given configuration key.getKeys()Returns an iterator with all keys defined in this configuration.Returns an iterator with all keys defined in this configuration that start with the given prefix.Get a List of strings associated with the given configuration key.Get a List of strings associated with the given configuration key.longGet a long associated with the given configuration key.longGet a long associated with the given configuration key.Get aLongassociated with the given configuration key.intgetMaxIndex(String key) Returns the maximum defined index for the given key.getProperties(String key) Get a list of properties associated with the given configuration key.getProperty(String key) Fetches the specified property.Returns the object to synchronize on a reload.getRoot()Returns the root node of this hierarchical configuration.Returns the root node of this hierarchical configuration.shortGet a short associated with the given configuration key.shortGet a short associated with the given configuration key.Get aShortassociated with the given configuration key.Get a string associated with the given configuration key.Get a string associated with the given configuration key.String[]getStringArray(String key) Get an array of strings associated with the given configuration key.Returns a configuration with the same content as this configuration, but with all variables replaced by their actual values.booleanisEmpty()Checks if this configuration is empty.voidLoad the configuration from the specified reader.booleanRemoves the specified event listener so that it does not receive any further events caused by this object.booleanRemoves the specified error listener so that it does not receive any further events caused by this object.protected ObjectReturns an object from the store described by the key.voidSave the configuration to the specified writer.voidsetExpressionEngine(ExpressionEngine expressionEngine) Sets the expression engine to be used by this configuration.voidsetProperty(String key, Object value) Sets the value of the specified property.voidSets the root node of this hierarchical configuration.voidsetRootNode(ConfigurationNode rootNode) Sets the root node of this hierarchical configuration.Creates a newConfigurationobject containing all keys that start with the specified prefix.Methods inherited from class AbstractHierarchicalFileConfiguration
addPropertyDirect, configurationChanged, configurationError, createDelegate, fetchNodeList, getBasePath, getDelegate, getEncoding, getFile, getFileName, getFileSystem, getReloadingStrategy, getURL, isAutoSave, load, load, load, load, load, load, refresh, reload, resetFileSystem, save, save, save, save, save, save, setAutoSave, setBasePath, setDelegate, setEncoding, setFile, setFileName, setFileSystem, setReloadingStrategy, setURL, subnodeConfigurationChangedMethods inherited from class HierarchicalConfiguration
clearNode, clearNode, clearReferences, clone, createAddPath, createNode, createSubnodeConfiguration, createSubnodeConfiguration, fetchAddNode, findLastPathNode, findPropertyNodes, getDefaultExpressionEngine, nodeDefined, nodeDefined, removeNode, removeNode, setDefaultExpressionEngineMethods inherited from class AbstractConfiguration
addErrorLogListener, append, clearPropertyDirect, copy, createInterpolator, getDefaultListDelimiter, getDelimiter, getInterpolator, getListDelimiter, getLogger, getProperties, getSubstitutor, interpolate, interpolate, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissingMethods inherited from class EventSource
createErrorEvent, createEvent, fireError, fireEvent, isDetailEvents, setDetailEvents
-
Constructor Details
-
PatternSubtreeConfigurationWrapper
public PatternSubtreeConfigurationWrapper(AbstractHierarchicalFileConfiguration config, String path) Constructor- Parameters:
config- The Configuration to be wrapped.path- The base path pattern.
-
-
Method Details
-
getReloadLock
Description copied from class:HierarchicalConfigurationReturns the object to synchronize on a reload. This class is not reloadable so this object isn't important- Specified by:
getReloadLockin interfaceReloadable- Overrides:
getReloadLockin classAbstractHierarchicalFileConfiguration- Returns:
- the lock object
-
addProperty
Description copied from interface:ConfigurationAdd a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if the property:resource.loader = file
is already present in the configuration and you calladdProperty("resource.loader", "classpath")Then you will end up with a List like the following:["file", "classpath"]
- Specified by:
addPropertyin interfaceConfiguration- Overrides:
addPropertyin classAbstractConfiguration- Parameters:
key- The key to add the property to.value- The value to add.
-
clear
Description copied from class:HierarchicalConfigurationClears this configuration. This is a more efficient implementation than the one inherited from the base class. It directly removes all data from the root node.- Specified by:
clearin interfaceConfiguration- Overrides:
clearin classHierarchicalConfiguration
-
clearProperty
Description copied from class:HierarchicalConfigurationRemoves the property with the given key. Properties with names that start with the given key (i.e. properties below the specified key in the hierarchy) won't be affected.- Specified by:
clearPropertyin interfaceConfiguration- Overrides:
clearPropertyin classAbstractHierarchicalFileConfiguration- Parameters:
key- the key of the property to be removed
-
containsKey
Description copied from class:HierarchicalConfigurationChecks if the specified key is contained in this configuration. Note that for this configuration the term "contained" means that the key has an associated value. If there is a node for this key that has no value but children (either defined or undefined), this method will still return false .- Specified by:
containsKeyin interfaceConfiguration- Overrides:
containsKeyin classAbstractHierarchicalFileConfiguration- Parameters:
key- the key to be chekced- Returns:
- a flag if this key is contained in this configuration
-
getBigDecimal
Description copied from interface:ConfigurationGet aBigDecimalassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBigDecimalin interfaceConfiguration- Overrides:
getBigDecimalin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated BigDecimal if key is found and has valid format, default value otherwise.
-
getBigDecimal
Description copied from class:AbstractConfigurationGet aBigDecimalassociated with the given configuration key.- Specified by:
getBigDecimalin interfaceConfiguration- Overrides:
getBigDecimalin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated BigDecimal if key is found and has valid format
- See Also:
-
getBigInteger
Description copied from interface:ConfigurationGet aBigIntegerassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBigIntegerin interfaceConfiguration- Overrides:
getBigIntegerin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated BigInteger if key is found and has valid format, default value otherwise.
-
getBigInteger
Description copied from class:AbstractConfigurationGet aBigIntegerassociated with the given configuration key.- Specified by:
getBigIntegerin interfaceConfiguration- Overrides:
getBigIntegerin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated BigInteger if key is found and has valid format
- See Also:
-
getBoolean
Description copied from class:AbstractConfigurationGet a boolean associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBooleanin interfaceConfiguration- Overrides:
getBooleanin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated boolean.
- See Also:
-
getBoolean
Description copied from class:AbstractConfigurationObtains the value of the specified key and tries to convert it into aBooleanobject. If the property has no value, the passed in default value will be used.- Specified by:
getBooleanin interfaceConfiguration- Overrides:
getBooleanin classAbstractConfiguration- Parameters:
key- the key of the propertydefaultValue- the default value- Returns:
- the value of this key converted to a
Boolean - See Also:
-
getBoolean
Description copied from class:AbstractConfigurationGet a boolean associated with the given configuration key.- Specified by:
getBooleanin interfaceConfiguration- Overrides:
getBooleanin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated boolean.
- See Also:
-
getByte
Description copied from interface:ConfigurationGet a byte associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getBytein interfaceConfiguration- Overrides:
getBytein classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated byte.
-
getByte
Description copied from interface:ConfigurationGet aByteassociated with the given configuration key.- Specified by:
getBytein interfaceConfiguration- Overrides:
getBytein classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated byte if key is found and has valid format, default value otherwise.
-
getByte
Description copied from interface:ConfigurationGet a byte associated with the given configuration key.- Specified by:
getBytein interfaceConfiguration- Overrides:
getBytein classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated byte.
-
getDouble
Description copied from interface:ConfigurationGet a double associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getDoublein interfaceConfiguration- Overrides:
getDoublein classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated double.
-
getDouble
Description copied from interface:ConfigurationGet aDoubleassociated with the given configuration key.- Specified by:
getDoublein interfaceConfiguration- Overrides:
getDoublein classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated double if key is found and has valid format, default value otherwise.
-
getDouble
Description copied from interface:ConfigurationGet a double associated with the given configuration key.- Specified by:
getDoublein interfaceConfiguration- Overrides:
getDoublein classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated double.
-
getFloat
Description copied from interface:ConfigurationGet a float associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getFloatin interfaceConfiguration- Overrides:
getFloatin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated float.
-
getFloat
Description copied from interface:ConfigurationGet aFloatassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getFloatin interfaceConfiguration- Overrides:
getFloatin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated float if key is found and has valid format, default value otherwise.
-
getFloat
Description copied from interface:ConfigurationGet a float associated with the given configuration key.- Specified by:
getFloatin interfaceConfiguration- Overrides:
getFloatin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated float.
-
getInt
Description copied from interface:ConfigurationGet a int associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getIntin interfaceConfiguration- Overrides:
getIntin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated int.
-
getInt
Description copied from interface:ConfigurationGet a int associated with the given configuration key.- Specified by:
getIntin interfaceConfiguration- Overrides:
getIntin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated int.
-
getInteger
Description copied from interface:ConfigurationGet anIntegerassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getIntegerin interfaceConfiguration- Overrides:
getIntegerin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated int if key is found and has valid format, default value otherwise.
-
getKeys
Description copied from class:HierarchicalConfigurationReturns an iterator with all keys defined in this configuration. Note that the keys returned by this method will not contain any indices. This means that some structure will be lost.- Specified by:
getKeysin interfaceConfiguration- Overrides:
getKeysin classAbstractHierarchicalFileConfiguration- Returns:
- an iterator with the defined keys in this configuration
-
getKeys
Description copied from class:HierarchicalConfigurationReturns an iterator with all keys defined in this configuration that start with the given prefix. The returned keys will not contain any indices. This implementation tries to locate a node whose key is the same as the passed in prefix. Then the subtree of this node is traversed, and the keys of all nodes encountered (including attributes) are added to the result set.- Specified by:
getKeysin interfaceConfiguration- Overrides:
getKeysin classAbstractHierarchicalFileConfiguration- Parameters:
prefix- the prefix of the keys to start with- Returns:
- an iterator with the found keys
- See Also:
-
getList
Description copied from interface:ConfigurationGet a List of strings associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getListin interfaceConfiguration- Overrides:
getListin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated List of strings.
-
getList
Description copied from class:AbstractConfigurationGet a List of strings associated with the given configuration key. If the key doesn't map to an existing object an empty List is returned.- Specified by:
getListin interfaceConfiguration- Overrides:
getListin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated List.
- See Also:
-
getLong
Description copied from interface:ConfigurationGet a long associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getLongin interfaceConfiguration- Overrides:
getLongin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated long.
-
getLong
Description copied from interface:ConfigurationGet aLongassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getLongin interfaceConfiguration- Overrides:
getLongin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated long if key is found and has valid format, default value otherwise.
-
getLong
Description copied from interface:ConfigurationGet a long associated with the given configuration key.- Specified by:
getLongin interfaceConfiguration- Overrides:
getLongin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated long.
-
getProperties
Description copied from interface:ConfigurationGet a list of properties associated with the given configuration key. This method expects the given key to have an arbitrary number of String values, each of which is of the form {code key=value}. These strings are split at the equals sign, and the key parts will become keys of the returnedPropertiesobject, the value parts become values.- Specified by:
getPropertiesin interfaceConfiguration- Overrides:
getPropertiesin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated properties if key is found.
-
getProperty
Description copied from class:HierarchicalConfigurationFetches the specified property. This task is delegated to the associated expression engine.- Specified by:
getPropertyin interfaceConfiguration- Overrides:
getPropertyin classAbstractHierarchicalFileConfiguration- Parameters:
key- the key to be looked up- Returns:
- the found value
-
getShort
Description copied from interface:ConfigurationGet a short associated with the given configuration key.- Specified by:
getShortin interfaceConfiguration- Overrides:
getShortin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated short.
-
getShort
Description copied from interface:ConfigurationGet aShortassociated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getShortin interfaceConfiguration- Overrides:
getShortin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated short if key is found and has valid format, default value otherwise.
-
getShort
Description copied from interface:ConfigurationGet a short associated with the given configuration key.- Specified by:
getShortin interfaceConfiguration- Overrides:
getShortin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated short.
-
getString
Description copied from interface:ConfigurationGet a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Specified by:
getStringin interfaceConfiguration- Overrides:
getStringin classAbstractConfiguration- Parameters:
key- The configuration key.defaultValue- The default value.- Returns:
- The associated string if key is found and has valid format, default value otherwise.
-
getString
Description copied from class:AbstractConfigurationGet a string associated with the given configuration key.- Specified by:
getStringin interfaceConfiguration- Overrides:
getStringin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated string.
- See Also:
-
getStringArray
Description copied from class:AbstractConfigurationGet an array of strings associated with the given configuration key. If the key doesn't map to an existing object, an empty array is returned. If a property is added to a configuration, it is checked whether it contains multiple values. This is obvious if the added object is a list or an array. For strings it is checked whether the string contains the list delimiter character that can be specified using thesetListDelimiter()method. If this is the case, the string is split at these positions resulting in a property with multiple values.- Specified by:
getStringArrayin interfaceConfiguration- Overrides:
getStringArrayin classAbstractConfiguration- Parameters:
key- The configuration key.- Returns:
- The associated string array if key is found.
- See Also:
-
isEmpty
Description copied from class:HierarchicalConfigurationChecks if this configuration is empty. Empty means that there are no keys with any values, though there can be some (empty) nodes.- Specified by:
isEmptyin interfaceConfiguration- Overrides:
isEmptyin classAbstractHierarchicalFileConfiguration- Returns:
- a flag if this configuration is empty
-
setProperty
Description copied from class:HierarchicalConfigurationSets the value of the specified property.- Specified by:
setPropertyin interfaceConfiguration- Overrides:
setPropertyin classAbstractHierarchicalFileConfiguration- Parameters:
key- the key of the property to setvalue- the new value of this property
-
subset
Description copied from class:HierarchicalConfigurationCreates a newConfigurationobject containing all keys that start with the specified prefix. This implementation will return aHierarchicalConfigurationobject so that the structure of the keys will be saved. The nodes selected by the prefix (it is possible that multiple nodes are selected) are mapped to the root node of the returned configuration, i.e. their children and attributes will become children and attributes of the new root node. However a value of the root node is only set if exactly one of the selected nodes contain a value (if multiple nodes have a value, there is simply no way to decide how these values are merged together). Note that the returnedConfigurationobject is not connected to its source configuration: updates on the source configuration are not reflected in the subset and vice versa.- Specified by:
subsetin interfaceConfiguration- Overrides:
subsetin classHierarchicalConfiguration- Parameters:
prefix- the prefix of the keys for the subset- Returns:
- a new configuration object representing the selected subset
- See Also:
-
getRoot
Description copied from class:HierarchicalConfigurationReturns the root node of this hierarchical configuration. This method exists for backwards compatibility only. New code should use theHierarchicalConfiguration.getRootNode()method instead, which operates on the preferred data typeConfigurationNode.- Overrides:
getRootin classHierarchicalConfiguration- Returns:
- the root node
-
setRoot
Description copied from class:HierarchicalConfigurationSets the root node of this hierarchical configuration. This method exists for backwards compatibility only. New code should use theHierarchicalConfiguration.setRootNode(ConfigurationNode)method instead, which operates on the preferred data typeConfigurationNode.- Overrides:
setRootin classHierarchicalConfiguration- Parameters:
node- the root node
-
getRootNode
Description copied from class:HierarchicalConfigurationReturns the root node of this hierarchical configuration.- Overrides:
getRootNodein classHierarchicalConfiguration- Returns:
- the root node
-
setRootNode
Description copied from class:HierarchicalConfigurationSets the root node of this hierarchical configuration.- Overrides:
setRootNodein classHierarchicalConfiguration- Parameters:
rootNode- the root node
-
getExpressionEngine
Description copied from class:HierarchicalConfigurationReturns the expression engine used by this configuration. This method will never return null; if no specific expression engine was set, the default expression engine will be returned.- Overrides:
getExpressionEnginein classHierarchicalConfiguration- Returns:
- the current expression engine
-
setExpressionEngine
Description copied from class:HierarchicalConfigurationSets the expression engine to be used by this configuration. All property keys this configuration has to deal with will be interpreted by this engine.- Overrides:
setExpressionEnginein classHierarchicalConfiguration- Parameters:
expressionEngine- the new expression engine; can be null, then the default expression engine will be used
-
addNodes
Description copied from class:AbstractHierarchicalFileConfigurationDirectly adds sub nodes to this configuration. This implementation checks whether auto save is necessary after executing the operation.- Overrides:
addNodesin classAbstractHierarchicalFileConfiguration- Parameters:
key- the key where the nodes are to be addednodes- a collection with the nodes to be added
-
configurationAt
Description copied from class:HierarchicalConfigurationReturns a hierarchical subnode configuration object that wraps the configuration node specified by the given key. This method provides an easy means of accessing sub trees of a hierarchical configuration. In the returned configuration the sub tree can directly be accessed, it becomes the root node of this configuration. Because of this the passed in key must select exactly one configuration node; otherwise an
IllegalArgumentExceptionwill be thrown.The difference between this method and the
HierarchicalConfiguration.subset(String)method is thatsubset()supports arbitrary subsets of configuration nodes whileconfigurationAt()only returns a single sub tree. Please refer to the documentation of theSubnodeConfigurationclass to obtain further information about subnode configurations and when they should be used.With the
supportUpdateflag the behavior of the returnedSubnodeConfigurationregarding updates of its parent configuration can be determined. A subnode configuration operates on the same nodes as its parent, so changes at one configuration are normally directly visible for the other configuration. There are however changes of the parent configuration, which are not recognized by the subnode configuration per default. An example for this is a reload operation (for file-based configurations): Here the complete node set of the parent configuration is replaced, but the subnode configuration still references the old nodes. If such changes should be detected by the subnode configuration, thesupportUpdatesflag must be set to true. This causes the subnode configuration to reevaluate the key used for its creation each time it is accessed. This guarantees that the subnode configuration always stays in sync with its key, even if the parent configuration's data significantly changes. If such a change makes the key invalid - because it now no longer points to exactly one node -, the subnode configuration is not reconstructed, but keeps its old data. It is then quasi detached from its parent.- Overrides:
configurationAtin classHierarchicalConfiguration- Parameters:
key- the key that selects the sub treesupportUpdates- a flag whether the returned subnode configuration should be able to handle updates of its parent- Returns:
- a hierarchical configuration that contains this sub tree
- See Also:
-
configurationAt
Description copied from class:HierarchicalConfigurationReturns a hierarchical subnode configuration for the node specified by the given key. This is a short form forconfigurationAt(key, <b>false</b>).- Overrides:
configurationAtin classHierarchicalConfiguration- Parameters:
key- the key that selects the sub tree- Returns:
- a hierarchical configuration that contains this sub tree
- See Also:
-
configurationsAt
Description copied from class:HierarchicalConfigurationReturns a list of sub configurations for all configuration nodes selected by the given key. This method will evaluate the passed in key (using the currentExpressionEngine) and then create a subnode configuration for each returned node (likeHierarchicalConfiguration.configurationAt(String)}). This is especially useful when dealing with list-like structures. As an example consider the configuration that contains data about database tables and their fields. If you need access to all fields of a certain table, you can simply doList fields = config.configurationsAt("tables.table(0).fields.field"); for(Iterator it = fields.iterator(); it.hasNext();) { HierarchicalConfiguration sub = (HierarchicalConfiguration) it.next(); // now the children and attributes of the field node can be // directly accessed String fieldName = sub.getString("name"); String fieldType = sub.getString("type"); ...- Overrides:
configurationsAtin classHierarchicalConfiguration- Parameters:
key- the key for selecting the desired nodes- Returns:
- a list with hierarchical configuration objects; each configuration represents one of the nodes selected by the passed in key
-
clearTree
Description copied from class:HierarchicalConfigurationRemoves all values of the property with the given name and of keys that start with this name. So if there is a property with the key "foo" and a property with the key "foo.bar", a call ofclearTree("foo")would remove both properties.- Overrides:
clearTreein classAbstractHierarchicalFileConfiguration- Parameters:
key- the key of the property to be removed
-
getMaxIndex
Description copied from class:HierarchicalConfigurationReturns the maximum defined index for the given key. This is useful if there are multiple values for this key. They can then be addressed separately by specifying indices from 0 to the return value of this method.- Overrides:
getMaxIndexin classHierarchicalConfiguration- Parameters:
key- the key to be checked- Returns:
- the maximum defined index for this key
-
interpolatedConfiguration
Description copied from class:HierarchicalConfigurationReturns a configuration with the same content as this configuration, but with all variables replaced by their actual values. This implementation is specific for hierarchical configurations. It clones the current configuration and runs a specialized visitor on the clone, which performs interpolation on the single configuration nodes.- Overrides:
interpolatedConfigurationin classHierarchicalConfiguration- Returns:
- a configuration with all variables interpolated
-
addConfigurationListener
Description copied from class:EventSourceAdds a configuration listener to this object.- Overrides:
addConfigurationListenerin classEventSource- Parameters:
l- the listener to add
-
removeConfigurationListener
Description copied from class:EventSourceRemoves the specified event listener so that it does not receive any further events caused by this object.- Overrides:
removeConfigurationListenerin classEventSource- Parameters:
l- the listener to be removed- Returns:
- a flag whether the event listener was found
-
getConfigurationListeners
Description copied from class:EventSourceReturns a collection with all configuration event listeners that are currently registered at this object.- Overrides:
getConfigurationListenersin classEventSource- Returns:
- a collection with the registered
ConfigurationListeners (this collection is a snapshot of the currently registered listeners; manipulating it has no effect on this event source object)
-
clearConfigurationListeners
Description copied from class:EventSourceRemoves all registered configuration listeners.- Overrides:
clearConfigurationListenersin classEventSource
-
addErrorListener
Description copied from class:EventSourceAdds a new configuration error listener to this object. This listener will then be notified about internal problems.- Overrides:
addErrorListenerin classEventSource- Parameters:
l- the listener to register (must not be null)
-
removeErrorListener
Description copied from class:EventSourceRemoves the specified error listener so that it does not receive any further events caused by this object.- Overrides:
removeErrorListenerin classEventSource- Parameters:
l- the listener to remove- Returns:
- a flag whether the listener could be found and removed
-
clearErrorListeners
Description copied from class:EventSourceRemoves all registered error listeners.- Overrides:
clearErrorListenersin classEventSource
-
save
Description copied from interface:FileConfigurationSave the configuration to the specified writer.- Parameters:
writer- the writer- Throws:
ConfigurationException- if an error occurs during the save operation
-
load
Description copied from interface:FileConfigurationLoad the configuration from the specified reader.- Parameters:
reader- the reader- Throws:
ConfigurationException- if an error occurs during the load operation
-
getErrorListeners
Description copied from class:EventSourceReturns a collection with all configuration error listeners that are currently registered at this object.- Overrides:
getErrorListenersin classEventSource- Returns:
- a collection with the registered
ConfigurationErrorListeners (this collection is a snapshot of the currently registered listeners; it cannot be manipulated)
-
resolveContainerStore
Description copied from class:AbstractConfigurationReturns an object from the store described by the key. If the value is a Collection object, replace it with the first object in the collection.- Overrides:
resolveContainerStorein classAbstractConfiguration- Parameters:
key- The property key.- Returns:
- value Value, transparently resolving a possible collection dependency.
-