java.lang.Object
de.serra.so_dirty.difference.DifferenceNodes
- All Implemented Interfaces:
DifferenceNode,Iterable<DifferenceNode>
Multiple differences. Like an array or a class with fields.
- Author:
- Peter Lamby
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.serra.so_dirty.difference.DifferenceNode
DifferenceNode.EmptyDifferenceNode -
Constructor Summary
ConstructorsConstructorDescriptionDifferenceNodes(String name, DifferenceType @Nullable ... types) Constructs.DifferenceNodes(String name, @Nullable Character pathSeparator, DifferenceType @Nullable ... types) Constructs. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(DifferenceNode difference) Add a child difference.@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.iterator()<T> Tvisit(de.serra.so_dirty.difference.visit.DifferenceVisitor<T> visitor, DifferenceVisit<T> visit) Visits the current node.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.serra.so_dirty.difference.DifferenceNode
get, getChild, getTypesRecursive, isDifferent, isDifferent, isDifferentRecursiveMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DifferenceNodes
public DifferenceNodes(String name, @Nullable Character pathSeparator, DifferenceType @Nullable ... types) Constructs.- Parameters:
name- The relative path of this difference.pathSeparator- The separator to include when visiting.types- The types of difference for this node. Can benull.
-
DifferenceNodes
Constructs.- Parameters:
name- The relative path of this difference.types- The types of difference for this node. Can benull.
-
-
Method Details
-
visit
public <T> T visit(de.serra.so_dirty.difference.visit.DifferenceVisitor<T> visitor, DifferenceVisit<T> visit) Description copied from interface:DifferenceNodeVisits 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.- Specified by:
visitin interfaceDifferenceNode- Type Parameters:
T- The return type of the visit.- Parameters:
visitor- The visitor.visit- The visit.- Returns:
- The
DifferenceVisit.value().
-
getName
Description copied from interface:DifferenceNodeThe relative path inside the object tree.- Specified by:
getNamein interfaceDifferenceNode- Returns:
- The path.
-
getTypes
Description copied from interface:DifferenceNodeDescribes in what way the current node changed. Returns an empty set if there are no changes.- Specified by:
getTypesin interfaceDifferenceNode- Returns:
- The types of change if any.
-
getChildNullable
Description copied from interface:DifferenceNodeGets a direct child node in the object tree.Will return
nullif the child does not exist.- Specified by:
getChildNullablein interfaceDifferenceNode- Parameters:
name- The name of the child node.- Returns:
- The result of the desired node. May return
null.
-
add
Add a child difference.- Parameters:
difference- The child.
-
iterator
- Specified by:
iteratorin interfaceIterable<DifferenceNode>
-