Interface ObjectGraphVisitor<T>

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ObjectGraphVisitor<T>
    Visitor interface for traversing graphs. The visitor will visit every node of the graph in some order starting from the top level nodes, such that every node is visited exactly once.

    If a node has inbound edges from more than one other node, it is unspecified which parent the visitor will be invoked as a child of.

    Author:
    Tim Boudreau
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void enterNode​(T node, int depth)
      Enter a node; subsequent calls to enterNode before a call to exitNode means the subsequent nodes are referenced by the previous one.
      default void exitNode​(T node, int depth)
      Called when the last child of a node has been visited.
    • Method Detail

      • enterNode

        void enterNode​(T node,
                       int depth)
        Enter a node; subsequent calls to enterNode before a call to exitNode means the subsequent nodes are referenced by the previous one. EnterNode will be called exactly once for each node, starting from top-level and orphan nodes which have no antecedents. For nodes referenced by descendants, the order they are passed to enterNode is implementation-depenedent - they will appear nested under some node that calls them, but not more than one.
        Parameters:
        node - The node
        depth - The depth of this node in the tree, in the traversal pattern being used.
      • exitNode

        default void exitNode​(T node,
                              int depth)
        Called when the last child of a node has been visited.
        Parameters:
        node - The node
        depth - The depth of this node in the tree in the traversal pattern being used