public class SubnodeConfiguration extends HierarchicalReloadableConfiguration
A specialized hierarchical configuration class that wraps a single node of its parent configuration.
 Configurations of this type are initialized with a parent configuration and a
 configuration node of this configuration. This node becomes the root node of
 the subnode configuration. All property accessor methods are evaluated
 relative to this root node. A good use case for a
 SubnodeConfiguration is when multiple properties from a
 specific sub tree of the whole configuration need to be accessed. Then a
 SubnodeConfiguration can be created with the parent node of
 the affected sub tree as root node. This allows for simpler property keys and
 is also more efficient.
 
A subnode configuration and its parent configuration operate on the same hierarchy of configuration nodes. So if modifications are performed at the subnode configuration, these changes are immediately visible in the parent configuration. Analogously will updates of the parent configuration affect the subnode configuration if the sub tree spanned by the subnode configuration's root node is involved.
There are however changes at the parent configuration, which cause the subnode configuration to become detached. An example for such a change is a reload operation of a file-based configuration, which replaces all nodes of the parent configuration. The subnode configuration per default still references the old nodes. Another example are list structures: a subnode configuration can be created to point on the ith element of the list. Now list elements can be added or removed, so that the list elements' indices change. In such a scenario the subnode configuration would always point to the same list element, regardless of its current index.
 To solve these problems and make a subnode configuration aware of
 such structural changes of its parent, it is possible to associate a
 subnode configuration with a configuration key. This can be done by calling
 the setSubnodeKey() method. If here a key is set, the subnode
 configuration will evaluate it on each access, thus ensuring that it is
 always in sync with its parent. In this mode the subnode configuration really
 behaves like a live-view on its parent. The price for this is a decreased
 performance because now an additional evaluation has to be performed on each
 property access. So this mode should only be used if necessary; if for
 instance a subnode configuration is only used for a temporary convenient
 access to a complex configuration, there is no need to make it aware for
 structural changes of its parent. If a subnode configuration is created
 using the configurationAt() method of HierarchicalConfiguration
 (which should be the preferred way), with an additional boolean parameter it
 can be specified whether the resulting subnode configuration should be
 aware of structural changes or not. Then the configuration key will be
 automatically set.
 
Note: At the moment support for creating a subnode configuration that is aware of structural changes of its parent from another subnode configuration (a "sub subnode configuration") is limited. This only works if
 When a subnode configuration is created, it inherits the settings of its
 parent configuration, e.g. some flags like the
 throwExceptionOnMissing flag or the settings for handling list
 delimiters) or the expression engine. If these settings are changed later in
 either the subnode or the parent configuration, the changes are not visible
 for each other. So you could create a subnode configuration, change its
 expression engine without affecting the parent configuration.
 
 From its purpose this class is quite similar to
 SubsetConfiguration. The difference is that a subset
 configuration of a hierarchical configuration may combine multiple
 configuration nodes from different sub trees of the configuration, while all
 nodes in a subnode configuration belong to the same sub tree. If an
 application can live with this limitation, it is recommended to use this
 class instead of SubsetConfiguration because creating a subset
 configuration is more expensive than creating a subnode configuration.
 
HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitorEVENT_ADD_NODES, EVENT_CLEAR_TREE, EVENT_SUBNODE_CHANGEDEND_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN| Constructor and Description | 
|---|
| SubnodeConfiguration(HierarchicalConfiguration parent,
                    ConfigurationNode root)Creates a new instance of  SubnodeConfigurationand
 initializes it with the parent configuration and the new root node. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected ConfigurationInterpolator | createInterpolator()Creates a ConfigurationInterpolator with a chain to the parent's
 interpolator. | 
| protected HierarchicalConfiguration.Node | createNode(String name)Creates a new node. | 
| protected SubnodeConfiguration | createSubnodeConfiguration(ConfigurationNode node)Returns a hierarchical configuration object for the given sub node. | 
| protected SubnodeConfiguration | createSubnodeConfiguration(ConfigurationNode node,
                          String subnodeKey)Returns a hierarchical configuration object for the given sub node that
 is aware of structural changes of its parent. | 
| HierarchicalConfiguration | getParent()Returns the parent configuration of this subnode configuration. | 
| ConfigurationNode | getRootNode()Returns the root node for this configuration. | 
| String | getSubnodeKey()Returns the key that was used to construct this configuration. | 
| protected void | initFromParent(HierarchicalConfiguration parentConfig)Initializes this subnode configuration from the given parent
 configuration. | 
| void | setSubnodeKey(String subnodeKey)Sets the key to the root node of this subnode configuration. | 
getReloadLockaddNodes, addPropertyDirect, clear, clearNode, clearNode, clearProperty, clearReferences, clearTree, clone, configurationAt, configurationAt, configurationsAt, containsKey, createAddPath, fetchAddNode, fetchNodeList, findLastPathNode, findPropertyNodes, getDefaultExpressionEngine, getExpressionEngine, getKeys, getKeys, getMaxIndex, getProperty, getRoot, interpolatedConfiguration, isEmpty, nodeDefined, nodeDefined, removeNode, removeNode, setDefaultExpressionEngine, setExpressionEngine, setProperty, setRoot, setRootNode, subnodeConfigurationChanged, subsetaddErrorLogListener, addProperty, append, clearPropertyDirect, copy, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissingaddConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEventspublic SubnodeConfiguration(HierarchicalConfiguration parent, ConfigurationNode root)
SubnodeConfiguration and
 initializes it with the parent configuration and the new root node.parent - the parent configurationroot - the root node of this subnode configurationpublic HierarchicalConfiguration getParent()
public String getSubnodeKey()
public void setSubnodeKey(String subnodeKey)
subnodeKey - the key used to construct this configurationpublic ConfigurationNode getRootNode()
getRootNode in class HierarchicalConfigurationsetSubnodeKey(String)protected SubnodeConfiguration createSubnodeConfiguration(ConfigurationNode node)
SubnodeConfiguration object will have the same parent than
 this object.createSubnodeConfiguration in class HierarchicalConfigurationnode - the sub node, for which the configuration is to be createdprotected SubnodeConfiguration createSubnodeConfiguration(ConfigurationNode node, String subnodeKey)
createSubnodeConfiguration in class HierarchicalConfigurationnode - the sub node, for which the configuration is to be createdsubnodeKey - the construction keyprotected HierarchicalConfiguration.Node createNode(String name)
createNode in class HierarchicalConfigurationname - the node's nameprotected void initFromParent(HierarchicalConfiguration parentConfig)
parentConfig - the parent configurationprotected ConfigurationInterpolator createInterpolator()
createInterpolator in class AbstractConfigurationCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.