org.apache.commons.configuration
abstract class HierarchicalConfigurationConverter extends Object
A base class for converters that transform a normal configuration object into a hierarchical configuration.
This class provides a default mechanism for iterating over the keys in a configuration and to throw corresponding element start and end events. By handling these events a hierarchy can be constructed that is equivalent to the keys in the original configuration.
Concrete sub classes will implement event handlers that generate SAX
events for XML processing or construct a
HierarchicalConfiguration
root node. All in all with this class
it is possible to treat a default configuration as if it was a hierarchical
configuration, which can be sometimes useful.
Version: $Id: HierarchicalConfigurationConverter.java 439648 2006-09-02 20:42:10Z oheger $
Method Summary | |
---|---|
protected void | closeElements(ConfigurationKey keyLast, ConfigurationKey keyAct)
Fires all necessary element end events for the specified keys. |
protected abstract void | elementEnd(String name)
An event handler method that is called when an element ends. |
protected abstract void | elementStart(String name, Object value)
An event handler method that is called when an element starts.
|
protected void | fireValue(String name, Object value)
Fires all necessary element start events with the actual element values.
|
protected String | openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set keySet)
Fires all necessary element start events for the specified key. |
void | process(Configuration config)
Processes the specified configuration object. |
protected Iterator | reverseIterator(ConfigurationKey key)
Helper method for determining a reverse iterator for the specified key.
|
Parameters: keyLast the last processed key keyAct the actual key
elementStart()
there will be a corresponding call
of this method. Concrete sub classes must implement it to perform a
proper event handling.
Parameters: name the name of the ending element
Parameters: name the name of the new element value the element's value; can be null if the element does not have any value
Parameters: name the name of the actual element value the element's value
Parameters: keyLast the last processed key keyAct the actual key config the configuration to process keySet the set with the processed keys
Returns: the name of the last element on the path
elementStart()
and
elementEnd()
methods.
Parameters: config the configuration to be processed
Parameters: key the key
Returns: a reverse iterator for the parts of this key