org.apache.commons.configuration2.tree

## Class NodeAddData<T>

- java.lang.Object
- - org.apache.commons.configuration2.tree.NodeAddData<T>

- Type Parameters:
    `T` - the type of nodes this class can handle

      public class NodeAddData<T>
      extends Object

  A simple data class used by `ExpressionEngine` to store the results of the `prepareAdd()` operation.

  If a new property is to be added to a configuration, the affected `Configuration` object must know, where in its hierarchy of configuration nodes new elements have to be added. This information is obtained by an `ExpressionEngine` object that interprets the key of the new property. This expression engine will pack all information necessary for the configuration to perform the add operation in an instance of this class.

  Information managed by this class contains:

  - the configuration node, to which new elements must be added
  - the name of the new node
  - whether the new node is a child node or an attribute node
  - if a whole branch is to be added at once, the names of all nodes between the parent node (the target of the add operation) and the new node
  Since:
    1.3
  Version:
    $Id: NodeAddData.java 1679790 2015-05-16 17:48:43Z oheger $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NodeAddData(T parentNode, String newName, boolean isAttr, Collection<String> intermediateNodes)` Creates a new instance of `NodeAddData` and initializes it.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getNewNodeName()` Returns the name of the new node.
    `T` | `getParent()` Returns the parent node.
    `List<String>` | `getPathNodes()` Returns a list with further nodes that must be added.
    `boolean` | `isAttribute()` Returns a flag if the new node to be added is an attribute.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NodeAddData

          public NodeAddData(T parentNode,
                             String newName,
                             boolean isAttr,
                             Collection<String> intermediateNodes)

      Creates a new instance of `NodeAddData` and initializes it.
      Parameters:
        `parentNode` - the parent node of the add operation
        `newName` - the name of the new node
        `isAttr` - flag whether the new node is an attribute
        `intermediateNodes` - an optional collection with path nodes

  - ### Method Detail

    - #### isAttribute

          public boolean isAttribute()

      Returns a flag if the new node to be added is an attribute.
      Returns:
        true for an attribute node, false for a child node

    - #### getNewNodeName

          public String getNewNodeName()

      Returns the name of the new node.
      Returns:
        the new node's name

    - #### getParent

          public T getParent()

      Returns the parent node.
      Returns:
        the parent node

    - #### getPathNodes

          public List<String> getPathNodes()

      Returns a list with further nodes that must be added. This is needed if a complete branch is to be added at once. For instance, imagine that there exists only a node `database`. Now the key `database.connection.settings.username` (assuming the syntax of the default expression engine) is to be added. Then `username` is the name of the new node, but the nodes `connection` and `settings` must be added to the parent node first. In this example these names would be returned by this method.
      Returns:
        a list with the names of nodes that must be added as parents of the new node (never null)

Copyright © 2001–2016 The Apache Software Foundation. All rights reserved.