Class ModelTransaction.Operations
java.lang.Object
org.apache.commons.configuration2.tree.ModelTransaction.Operations
- Enclosing class:
- ModelTransaction
A helper class which collects multiple update operations to be executed on a single node.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection<ImmutableNode>
A collection with nodes added by an operation.An operation for manipulating child nodes.private Collection<ModelTransaction.Operation>
A collection for the other operations to be performed on the target node. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an operation which manipulates children.void
Adds an operation.void
apply
(ImmutableNode target, int level) Executes all operations stored in this object on the given target node.private void
Checks whether new nodes have been added during operation execution.void
newNodesAdded
(Collection<ImmutableNode> newNodes) Notifies this object that new nodes have been added by a sub operation.private void
propagateChange
(ImmutableNode target, ImmutableNode node, int level) Propagates the changes on the target node to the next level above of the hierarchy.
-
Field Details
-
childrenOperation
An operation for manipulating child nodes. -
operations
A collection for the other operations to be performed on the target node. -
addedNodesInOperation
A collection with nodes added by an operation.
-
-
Constructor Details
-
Operations
private Operations()
-
-
Method Details
-
addChildrenOperation
Adds an operation which manipulates children.- Parameters:
co
- the operation
-
addOperation
Adds an operation.- Parameters:
op
- the operation
-
newNodesAdded
Notifies this object that new nodes have been added by a sub operation. It has to be ensured that these nodes are added to the parent mapping.- Parameters:
newNodes
- the collection of newly added nodes
-
apply
Executes all operations stored in this object on the given target node. The resulting node then has to be integrated in the current node hierarchy. Unless the root node is already reached, this causes another updated operation to be created which replaces the manipulated child in the parent node.- Parameters:
target
- the target node for this operationlevel
- the level of the target node
-
propagateChange
Propagates the changes on the target node to the next level above of the hierarchy. If the updated node is no longer defined, it can even be removed from its parent. Otherwise, it is just replaced.- Parameters:
target
- the target node for this operationnode
- the resulting node after applying all operationslevel
- the level of the target node
-
handleAddedNodes
Checks whether new nodes have been added during operation execution. If so, the parent mapping has to be updated.- Parameters:
node
- the resulting node after applying all operations
-