public class ApplyDiff extends Object implements NodeStateDiff
NodeBuilder
methods necessary to go from a given base state
to any given target state.
The expected usage pattern looks like this:
NodeState base = ...; NodeState target = ...; NodeBuilder builder = base.builder(); target.compareAgainstBaseState(base, new ApplyDiff(builder)); assertEquals(target, builder.getNodeState());
Alternatively, the apply(NodeState)
method can be used to set
the content of a given builder:
NodeBuilder builder = ...; NodeState target = ...; new ApplyDiff(builder).apply(target); assertEquals(target, builder.getNodeState());
Constructor and Description |
---|
ApplyDiff(NodeBuilder builder) |
Modifier and Type | Method and Description |
---|---|
void |
apply(NodeState target) |
boolean |
childNodeAdded(String name,
NodeState after)
Called for all added child nodes.
|
boolean |
childNodeChanged(String name,
NodeState before,
NodeState after)
Called for all child nodes that may contain changes between the before
and after states.
|
boolean |
childNodeDeleted(String name,
NodeState before)
Called for all deleted child nodes.
|
boolean |
propertyAdded(PropertyState after)
Called for all added properties.
|
boolean |
propertyChanged(PropertyState before,
PropertyState after)
Called for all changed properties.
|
boolean |
propertyDeleted(PropertyState before)
Called for all deleted properties.
|
public ApplyDiff(NodeBuilder builder)
public void apply(NodeState target)
public boolean propertyAdded(PropertyState after)
NodeStateDiff
propertyAdded
in interface NodeStateDiff
after
- property state after the changetrue
to continue the comparison, false
to stoppublic boolean propertyChanged(PropertyState before, PropertyState after)
NodeStateDiff
propertyChanged
in interface NodeStateDiff
before
- property state before the changeafter
- property state after the changetrue
to continue the comparison, false
to stoppublic boolean propertyDeleted(PropertyState before)
NodeStateDiff
propertyDeleted
in interface NodeStateDiff
before
- property state before the changetrue
to continue the comparison, false
to stoppublic boolean childNodeAdded(String name, NodeState after)
NodeStateDiff
childNodeAdded
in interface NodeStateDiff
name
- name of the added child nodeafter
- child node state after the changetrue
to continue the comparison, false
to stoppublic boolean childNodeChanged(String name, NodeState before, NodeState after)
NodeStateDiff
childNodeChanged
in interface NodeStateDiff
name
- name of the changed child nodebefore
- child node state before the changeafter
- child node state after the changetrue
to continue the comparison, false
to stoppublic boolean childNodeDeleted(String name, NodeState before)
NodeStateDiff
childNodeDeleted
in interface NodeStateDiff
name
- name of the deleted child nodebefore
- child node state before the changetrue
to continue the comparison, false
to stop"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"