Package org.apache.commons.configuration2.tree

# Interface ConfigurationNodeVisitor<T>

Type Parameters:
  `T` - the type of the nodes processed by this visitor

All Known Implementing Classes:
  `BaseHierarchicalConfiguration.BuilderVisitor`, `ConfigurationNodeVisitorAdapter`

public interface ConfigurationNodeVisitor<T>

Definition of a Visitor interface for a configuration node structure.

This is a typical application of the GoF Visitor pattern. An object implementing this interface can be used to traverse a hierarchical structure of nodes in various ways. The type of the nodes in the structure is generic; a corresponding `NodeHandler` implementation must be available for navigating through the structure.

Note that the exact way the methods of a `ConfigurationNodeVisitor` are invoked is dependent on a specific traversal process.

Since:
  1.3

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `terminate()`
  Returns a flag whether the current visit process should be aborted.
  `void`
  `visitAfterChildren(T node, NodeHandler<T> handler)`
  Visits the specified node after after its children - if existing - have been processed.
  `void`
  `visitBeforeChildren(T node, NodeHandler<T> handler)`
  Visits the specified node before the children of this node - if existing - are processed.

- ## Method Details

  - ### visitBeforeChildren

    void visitBeforeChildren(T node, NodeHandler<T> handler)
    Visits the specified node before the children of this node - if existing - are processed.
    Parameters:
      `node` - the node to be visited
      `handler` - the `NodeHandler`

  - ### visitAfterChildren

    void visitAfterChildren(T node, NodeHandler<T> handler)
    Visits the specified node after after its children - if existing - have been processed.
    Parameters:
      `node` - the node to be visited
      `handler` - the `NodeHandler`

  - ### terminate

    boolean terminate()
    Returns a flag whether the current visit process should be aborted. This method allows a visitor implementation to state that it does not need any further data. It may be used e.g. by visitors that search for a certain node in the hierarchy. After that node was found, there is no need to process the remaining nodes, too. This method is called after each visited node. A result of true indicates that the current iteration is to be aborted.
    Returns:
      a flag if the visit process should be stopped