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 java.lang.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
- Version:
- $Id: NodeUpdateData.java 1790899 2017-04-10 21:56:46Z ggregory $
-
-
Constructor Summary
Constructors Constructor Description NodeUpdateData(java.util.Map<QueryResult<T>,java.lang.Object> changedValues, java.util.Collection<java.lang.Object> newValues, java.util.Collection<QueryResult<T>> removedNodes, java.lang.String key)
Creates a new instance ofNodeUpdateData
and initializes all its properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<QueryResult<T>,java.lang.Object>
getChangedValues()
Returns an unmodifiable map with the values to be changed.java.lang.String
getKey()
Returns the key for this update operation.java.util.Collection<java.lang.Object>
getNewValues()
Returns a collection with the values to be newly added.java.util.Collection<QueryResult<T>>
getRemovedNodes()
Adds a collection with the nodes to be removed.
-
-
-
Constructor Detail
-
NodeUpdateData
public NodeUpdateData(java.util.Map<QueryResult<T>,java.lang.Object> changedValues, java.util.Collection<java.lang.Object> newValues, java.util.Collection<QueryResult<T>> removedNodes, java.lang.String key)
Creates a new instance ofNodeUpdateData
and initializes all its properties. All passed in collections are optional and can be null.- Parameters:
changedValues
- the map defining the changed valuesnewValues
- the collection with the new valuesremovedNodes
- the collection with the nodes to be removedkey
- the key of the update operation
-
-
Method Detail
-
getChangedValues
public java.util.Map<QueryResult<T>,java.lang.Object> getChangedValues()
Returns 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
-
getNewValues
public java.util.Collection<java.lang.Object> getNewValues()
Returns 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 java.util.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
-
getKey
public java.lang.String getKey()
Returns the key for this update operation.- Returns:
- the key for this operation
-
-