ReferenceNodeHandler (Apache Commons Configuration 2.15.1 API)
Description: declaration: package: org.apache.commons.configuration2.tree, interface: ReferenceNodeHandler

Package org.apache.commons.configuration2.tree

# Interface ReferenceNodeHandler

All Superinterfaces:
  `NodeHandler<ImmutableNode>`

public interface ReferenceNodeHandler extends NodeHandler<ImmutableNode>

An extension of the `NodeHandler` interface which allows access to so-called references stored for a node.

Some specialized configuration implementations needs to store additional data for the nodes representing configuration properties. This interface provides methods for querying this data. For instance, it is possible to query a reference object stored for a specific node.

`InMemoryNodeModel` supports references. It can be queried for a `ReferenceNodeHandler` which can then be used for dealing with references.

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getReference(ImmutableNode node)`
  Gets the reference object associated with the specified node.
  `List<Object>`
  `removedReferences()`
  Returns a list with the reference objects for nodes which have been removed.

  ### Methods inherited from interface org.apache.commons.configuration2.tree.NodeHandler

  `getAttributes, getAttributeValue, getChild, getChildren, getChildren, getChildrenCount, getMatchingChildren, getMatchingChildrenCount, getParent, getRootNode, getValue, hasAttributes, indexOfChild, isDefined, nodeName`

- ## Method Details

  - ### getReference

    Object getReference(ImmutableNode node)
    Gets the reference object associated with the specified node. If no reference data is associated with this node, result is null.
    Parameters:
      `node` - the node in question
    Returns:
      the reference object for this node or null

  - ### removedReferences

    List<Object> removedReferences()
    Returns a list with the reference objects for nodes which have been removed. Whenever a node associated with a reference object is removed from the nodes structure managed by the owning model, the reference object is recorded. This is necessary for instance to free some resources. With this method all recorded reference objects can be queried. They are typically returned in the order in which they have been removed.
    Returns:
      a list with reference objects for nodes removed from the model