Schnittstelle DifferenceNode

Alle Superschnittstellen:
Iterable<DifferenceNode>
Alle bekannten Implementierungsklassen:
DifferenceNode.EmptyDifferenceNode, DifferenceNodes, LeafDifferenceNode, MapDifferenceNode

public interface DifferenceNode extends Iterable<DifferenceNode>
The result of a diff operation. Represents a single node in the object tree.
Autor:
Peter Lamby
  • Methodendetails

    • 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 this node has been visited.

      The visiting of children can be prevented by calling DifferenceVisit.dontGoDeeper() usually from the visitor.

      Typparameter:
      T - The return type of the visit.
      Parameter:
      visitor - The visitor.
      visit - The visit.
      Gibt zurück:
      The DifferenceVisit.value().
    • getName

      String getName()
      The relative path inside the object tree.
      Gibt zurück:
      The path.
    • getTypes

      Set<DifferenceType> getTypes()
      Describes in what way the current node changed. Returns an empty set if there are no changes.
      Gibt zurück:
      The types of change if any.
    • getTypesRecursive

      default Set<DifferenceType> getTypesRecursive()
      All the DifferenceType in the hierarchy.
      Gibt zurück:
      all the DifferenceType in the hierarchy.
    • get

      default DifferenceNode get(String path)
      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.

      Parameter:
      path - The path expression.
      Gibt zurück:
      The difference node at the specified path.
    • getChildNullable

      @Nullable DifferenceNode getChildNullable(String name)
      Gets a direct child node in the object tree.

      Will return null if the child does not exist.

      Parameter:
      name - The name of the child node.
      Gibt zurück:
      The result of the desired node. May return null.
    • getChild

      default DifferenceNode getChild(String childName)
      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.

      Parameter:
      childName - The name of the child node.
      Gibt zurück:
      The result of the desired node. Will return a result with no changes if the node does not exist.
    • isDifferent

      default boolean isDifferent(DifferenceType @Nullable ... types)
      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. If types is null this methods checks for any difference. If types.length == 0 this method will always return false.

      Parameter:
      types - The types of difference to check for.
      Gibt zurück:
      true if there is a difference described by types false otherwise.
    • isDifferent

      default boolean isDifferent(String path, DifferenceType @Nullable ... types)
      Convenience method for
      differenceNode.getChild("myPath").isDifferent(types...);
      
      Parameter:
      path - The relative path of the desired node to be checked.
      types - The types of difference to check for.
      Gibt zurück:
      true if there is a difference described by types false otherwise.
    • isDifferentRecursive

      default boolean isDifferentRecursive(DifferenceType @Nullable ... types)
      Did the current node or one of its children change?

      This method will only report a difference if it's one of the types. If types is null this methods checks for any difference. If types.length == 0 this method will always return false.

      Parameter:
      types - The types of difference to check for.
      Gibt zurück:
      true if the current node or its children changed. false otherwise.