org.apache.jackrabbit.mk.model
Class NodeStateDiff

java.lang.Object
  extended by org.apache.jackrabbit.mk.model.NodeStateDiff
Direct Known Subclasses:
TraversingNodeDiffHandler

public class NodeStateDiff
extends Object

Utility base class for comparing two NodeState instances. The compare(NodeState, NodeState) method will go through all properties and child nodes of the two states, calling the relevant added, changed or deleted methods where appropriate. Differences in the ordering of properties or child nodes do not affect the comparison.


Constructor Summary
NodeStateDiff()
           
 
Method Summary
 void childNodeAdded(String name, NodeState after)
          Called by compare(NodeState, NodeState) for all added child nodes.
 void childNodeChanged(String name, NodeState before, NodeState after)
          Called by compare(NodeState, NodeState) for all changed child nodes.
 void childNodeDeleted(String name, NodeState before)
          Called by compare(NodeState, NodeState) for all deleted child nodes.
 void compare(NodeState before, NodeState after)
          Compares the given two node states.
 void propertyAdded(PropertyState after)
          Called by compare(NodeState, NodeState) for all added properties.
 void propertyChanged(PropertyState before, PropertyState after)
          Called by compare(NodeState, NodeState) for all changed properties.
 void propertyDeleted(PropertyState before)
          Called by compare(NodeState, NodeState) for all deleted properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeStateDiff

public NodeStateDiff()
Method Detail

propertyAdded

public void propertyAdded(PropertyState after)
Called by compare(NodeState, NodeState) for all added properties. The default implementation does nothing.

Parameters:
after - property state after the change

propertyChanged

public void propertyChanged(PropertyState before,
                            PropertyState after)
Called by compare(NodeState, NodeState) for all changed properties. The names of the given two property states are guaranteed to be the same. The default implementation does nothing.

Parameters:
before - property state before the change
after - property state after the change

propertyDeleted

public void propertyDeleted(PropertyState before)
Called by compare(NodeState, NodeState) for all deleted properties. The default implementation does nothing.

Parameters:
before - property state before the change

childNodeAdded

public void childNodeAdded(String name,
                           NodeState after)
Called by compare(NodeState, NodeState) for all added child nodes. The default implementation does nothing.

Parameters:
name - name of the added child node
after - child node state after the change

childNodeChanged

public void childNodeChanged(String name,
                             NodeState before,
                             NodeState after)
Called by compare(NodeState, NodeState) for all changed child nodes. The default implementation does nothing.

Parameters:
name - name of the changed child node
before - child node state before the change
after - child node state after the change

childNodeDeleted

public void childNodeDeleted(String name,
                             NodeState before)
Called by compare(NodeState, NodeState) for all deleted child nodes. The default implementation does nothing.

Parameters:
name - name of the deleted child node
before - child node state before the change

compare

public void compare(NodeState before,
                    NodeState after)
Compares the given two node states. Any found differences are reported by calling the relevant added, changed or deleted methods.

Parameters:
before - node state before changes
after - node state after changes


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.