Package org.apache.commons.configuration2.tree

# Class NodeUpdateData<T>

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

Type Parameters:
  `T` - the type of nodes involved in this update operation

public class NodeUpdateData<T> extends Object

A simple data class used by node models to store parameters of an update operation.

The `Configuration` interface provides a method for setting the value of a given key. The passed in value can be a single object or a collection of values. This makes an update operation rather complicated because a collection of query results selected by the passed in key has to be matched to another collection of values - and both collections can have different sizes. Therefore, an update operation may involve changing of existing nodes, adding new nodes (if there are more values than currently existing nodes), and removing nodes (if there are more existing nodes than provided values). This class collects all this information making it possible to actually perform the update based on a passed in instance.

Since:
  2.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NodeUpdateData(Map<QueryResult<T>,Object> changedValues, Collection<Object> newValues, Collection<QueryResult<T>> removedNodes, String key)`
  Creates a new instance of `NodeUpdateData` and initializes all its properties.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<QueryResult<T>,Object>`
  `getChangedValues()`
  Gets an unmodifiable map with the values to be changed.
  `String`
  `getKey()`
  Gets the key for this update operation.
  `Collection<Object>`
  `getNewValues()`
  Gets a collection with the values to be newly added.
  `Collection<QueryResult<T>>`
  `getRemovedNodes()`
  Adds a collection with the nodes to be removed.

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

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

- ## Constructor Details

  - ### NodeUpdateData

    public NodeUpdateData(Map<QueryResult<T>,Object> changedValues, Collection<Object> newValues, Collection<QueryResult<T>> removedNodes, String key)
    Creates a new instance of `NodeUpdateData` and initializes all its properties. All passed in collections are optional and can be null.
    Parameters:
      `changedValues` - the map defining the changed values
      `newValues` - the collection with the new values
      `removedNodes` - the collection with the nodes to be removed
      `key` - the key of the update operation

- ## Method Details

  - ### getChangedValues

    public Map<QueryResult<T>,Object> getChangedValues()
    Gets an unmodifiable map with the values to be changed. The keys of the map are the query results for the nodes affected, the values are the new values to be assigned to these nodes.
    Returns:
      the map with values to be changed

  - ### getKey

    public String getKey()
    Gets the key for this update operation.
    Returns:
      the key for this operation

  - ### getNewValues

    public Collection<Object> getNewValues()
    Gets a collection with the values to be newly added. For these values new nodes have to be created and added under the key stored in this object.
    Returns:
      the collection with new values

  - ### getRemovedNodes

    public Collection<QueryResult<T>> getRemovedNodes()
    Adds a collection with the nodes to be removed. These nodes are no longer needed and have to be removed from the node model processing this request.
    Returns:
      the collection with nodes to be removed