Interface Visitor

All Known Implementing Classes:
VisitorWithResult
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 Visitor
Since:
1.0
Author:
Michael J. Simons
  • Method Details

    • enter

      void enter(Visitable segment)
      Enter a Visitable. Not all visitables will obey to the result
      Parameters:
      segment - the segment to visit.
    • enterWithResult

      default EnterResult enterWithResult(Visitable segment)
      A method that is used to pass control to some extent from the visitor to the Visitable. Not all visitables react to this, and we don't give any guarantees about which will. This method has been mainly introduced in parallel to enter(Visitable) so that existing external implementations of visitors won't break.
      Parameters:
      segment - the segment to visit.
      Returns:
      A result indicating whether visitation of child elements should continue or not.
      Since:
      2022.3.0
    • leave

      default void leave(Visitable segment)
      Leave a Visitable.
      Parameters:
      segment - the visited segment.