Class ModelTransaction.Operations

java.lang.Object
org.apache.commons.configuration2.tree.ModelTransaction.Operations
Enclosing class:
ModelTransaction

private final class ModelTransaction.Operations extends Object
A helper class which collects multiple update operations to be executed on a single node.
  • Field Details

  • Constructor Details

    • Operations

      private Operations()
  • Method Details

    • addChildrenOperation

      public void addChildrenOperation(ModelTransaction.ChildrenUpdateOperation co)
      Adds an operation which manipulates children.
      Parameters:
      co - the operation
    • addOperation

      public void addOperation(ModelTransaction.Operation op)
      Adds an operation.
      Parameters:
      op - the operation
    • newNodesAdded

      public void newNodesAdded(Collection<ImmutableNode> newNodes)
      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

      public void apply(ImmutableNode target, int level)
      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 operation
      level - the level of the target node
    • propagateChange

      private void propagateChange(ImmutableNode target, ImmutableNode node, int level)
      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 operation
      node - the resulting node after applying all operations
      level - the level of the target node
    • handleAddedNodes

      private void handleAddedNodes(ImmutableNode node)
      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