- All Superinterfaces:
Iterable<DifferenceNode>
- All Known Implementing Classes:
DifferenceNode.EmptyDifferenceNode,DifferenceNodes,LeafDifferenceNode,MapDifferenceNode
- Author:
- Peter Lamby
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA Difference that is always empty. -
Method Summary
Modifier and TypeMethodDescriptiondefault DifferenceNodeGets a differenceNode specified by an expression.default DifferenceNodeGets a direct child node in the object tree.@Nullable DifferenceNodegetChildNullable(String name) Gets a direct child node in the object tree.getName()The relative path inside the object tree.getTypes()Describes in what way the current node changed.default Set<DifferenceType>All theDifferenceTypein the hierarchy.default booleanisDifferent(DifferenceType @Nullable ... types) Did the node change in one of the ways described by types.default booleanisDifferent(String path, DifferenceType @Nullable ... types) Convenience method fordifferenceNode.getChild("myPath").isDifferent(types...);default booleanisDifferentRecursive(DifferenceType @Nullable ... types) Did the current node or one of its children change?<T> Tvisit(de.serra.so_dirty.difference.visit.DifferenceVisitor<T> visitor, DifferenceVisit<T> visit) Visits the current node.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
visit
<T> T visit(de.serra.so_dirty.difference.visit.DifferenceVisitor<T> visitor, DifferenceVisit<T> visit) Visits the current node.The children will be visited after
thisnode has been visited.The visiting of children can be prevented by calling
DifferenceVisit.dontGoDeeper()usually from thevisitor.- Type Parameters:
T- The return type of the visit.- Parameters:
visitor- The visitor.visit- The visit.- Returns:
- The
DifferenceVisit.value().
-
getName
String getName()The relative path inside the object tree.- Returns:
- The path.
-
getTypes
Set<DifferenceType> getTypes()Describes in what way the current node changed. Returns an empty set if there are no changes.- Returns:
- The types of change if any.
-
getTypesRecursive
All theDifferenceTypein the hierarchy.- Returns:
- all the
DifferenceTypein the hierarchy.
-
get
Gets a differenceNode specified by an expression.There is no specification for the expression language right now. Please take a look at the PathUtilTest to see how to use it.
- Parameters:
path- The path expression.- Returns:
- The difference node at the specified path.
-
getChildNullable
Gets a direct child node in the object tree.Will return
nullif the child does not exist.- Parameters:
name- The name of the child node.- Returns:
- The result of the desired node. May return
null.
-
getChild
Gets a direct child node in the object tree.Will always successfully return even if the node does not exist. In that case an empty result is returned.
- Parameters:
childName- The name of the child node.- Returns:
- The result of the desired node. Will return a result with no changes if the node does not exist.
-
isDifferent
Did the node change in one of the ways described by types.This method will only report a difference if it's one of the
types. Iftypesisnullthis methods checks for any difference. Iftypes.length == 0this method will always return false.- Parameters:
types- The types of difference to check for.- Returns:
trueif there is a difference described bytypesfalseotherwise.
-
isDifferent
Convenience method fordifferenceNode.getChild("myPath").isDifferent(types...);- Parameters:
path- The relative path of the desired node to be checked.types- The types of difference to check for.- Returns:
trueif there is a difference described bytypesfalseotherwise.
-
isDifferentRecursive
Did the current node or one of its children change?This method will only report a difference if it's one of the
types. Iftypesisnullthis methods checks for any difference. Iftypes.length == 0this method will always return false.- Parameters:
types- The types of difference to check for.- Returns:
trueif the current node or its children changed.falseotherwise.
-