|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.configuration.HierarchicalConfigurationConverter
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.
HierarchicalConfiguration
Constructor Summary | |
(package private) |
HierarchicalConfigurationConverter()
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
HierarchicalConfigurationConverter()
Method Detail |
public void process(Configuration config)
elementStart()
and
elementEnd()
methods.
config
- the configuration to be processedprotected abstract void elementStart(String name, Object value)
name
- the name of the new elementvalue
- the element's value; can be null if the element
does not have any valueprotected abstract void elementEnd(String name)
elementStart()
there will be a corresponding call
of this method. Concrete sub classes must implement it to perform a
proper event handling.
name
- the name of the ending elementprotected void closeElements(ConfigurationKey keyLast, ConfigurationKey keyAct)
keyLast
- the last processed keykeyAct
- the actual keyprotected Iterator reverseIterator(ConfigurationKey key)
key
- the key
protected String openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set keySet)
keyLast
- the last processed keykeyAct
- the actual keyconfig
- the configuration to processkeySet
- the set with the processed keys
protected void fireValue(String name, Object value)
name
- the name of the actual elementvalue
- the element's value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |