Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.configuration
Class ConfigurationFactory.HierarchicalConfigurationNodeConverter

    java.lang.Object
      org.apache.commons.configuration.HierarchicalConfigurationConverter
          org.apache.commons.configuration.ConfigurationFactory.HierarchicalConfigurationNodeConverter

Enclosing class:
  ConfigurationFactory

static class ConfigurationFactory.HierarchicalConfigurationNodeConverter
extends HierarchicalConfigurationConverter

A specialized `HierarchicalConfigurationConverter` class that creates a `HierarchicalConfiguration` root node from an arbitrary `Configuration` object. This class is used to add additional configuration objects to the hierarchical configuration managed by the `ConfigurationBuilder`.

Constructor Summary
`ConfigurationFactory.HierarchicalConfigurationNodeConverter()` Default constructor.

Method Summary
`protected void` | `closeElements(ConfigurationKey keyLast, ConfigurationKey keyAct)` Fires all necessary element end events for the specified keys.
`protected void` | `elementEnd(String name)` Callback for an element end event.
`protected void` | `elementStart(String name, Object value)` Callback for an element start event.
`protected void` | `fireValue(String name, Object value)` Fires all necessary element start events with the actual element values.
`HierarchicalConfiguration.Node` | `getRootNode()` Returns the constructed root node.
`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

### ConfigurationFactory.HierarchicalConfigurationNodeConverter

    public ConfigurationFactory.HierarchicalConfigurationNodeConverter()

  Default constructor.

Method Detail

### elementStart

    protected void elementStart(String name,
                                Object value)

  Callback for an element start event. Creates a new node and adds it to the actual parent.

  Specified by:
    `elementStart` in class `HierarchicalConfigurationConverter`
  Parameters:
    `name` - the name of the new node
    `value` - the node's value

### elementEnd

    protected void elementEnd(String name)

  Callback for an element end event. Clears the stack.

  Specified by:
    `elementEnd` in class `HierarchicalConfigurationConverter`
  Parameters:
    `name` - the name of the element

### getRootNode

    public HierarchicalConfiguration.Node getRootNode()

  Returns the constructed root node.

  Returns:
    the root node

### process

    public void process(Configuration config)

  Processes the specified configuration object. This method implements the iteration over the configuration's keys. All defined keys are translated into a set of element start and end events represented by calls to the `elementStart()` and `elementEnd()` methods.

  Parameters:
    `config` - the configuration to be processed

### closeElements

    protected void closeElements(ConfigurationKey keyLast,
                                 ConfigurationKey keyAct)

  Fires all necessary element end events for the specified keys. This method is called for each key obtained from the configuration to be converted. It calculates the common part of the actual and the last processed key and thus determines how many elements must be closed.

  Parameters:
    `keyLast` - the last processed key
    `keyAct` - the actual key

### reverseIterator

    protected Iterator reverseIterator(ConfigurationKey key)

  Helper method for determining a reverse iterator for the specified key. This implementation returns an iterator that returns the parts of the given key in reverse order, ignoring indices.

  Parameters:
    `key` - the key
  Returns:
    a reverse iterator for the parts of this key

### openElements

    protected String openElements(ConfigurationKey keyLast,
                                  ConfigurationKey keyAct,
                                  Configuration config,
                                  Set keySet)

  Fires all necessary element start events for the specified key. This method is called for each key obtained from the configuration to be converted. It ensures that all elements "between" the last key and the actual key are opened and their values are set.

  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

### fireValue

    protected void fireValue(String name,
                             Object value)

  Fires all necessary element start events with the actual element values. This method is called for each key obtained from the configuration to be processed with the last part of the key as argument. The value can be either a single value or a collection.

  Parameters:
    `name` - the name of the actual element
    `value` - the element's value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.