Interface Visitor<T>

Type Parameters:
T - the type of objects this visitor can visit
All Known Implementing Classes:
DelegatingVisitor, PathAwareTypedVisitor, TypedVisitor, VisitorWiretap
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<T>
Interface for visiting objects of a specific type. Provides a visitor pattern implementation that can traverse and operate on objects. This interface supports both simple visiting and path-aware visiting.
  • Method Details

    • visit

      void visit(T element)
      Visits the specified element.
      Parameters:
      element - the element to visit
    • visit

      default void visit(List<Map.Entry<String,Object>> path, T element)
      Visits the specified element with path information. By default, this delegates to the simple visit method.
      Parameters:
      path - the path to the element being visited
      element - the element to visit
    • getType

      default Class<T> getType()
      Gets the type of objects this visitor can handle. Uses reflection to determine the generic type parameter.
      Returns:
      the class of objects this visitor handles, or null if not determinable
    • canVisit

      default <F> Boolean canVisit(List<Map.Entry<String,Object>> path, F target)
    • getRequirement

      default Predicate<List<Map.Entry<String,Object>>> getRequirement()
      Gets the requirement predicate for this visitor. The predicate determines whether this visitor should process a given path.
      Returns:
      a predicate that evaluates to true if this visitor should process the path
    • hasItem

      default <I> Predicate<List<Map.Entry<String,Object>>> hasItem(Class<I> type, Predicate<I> predicate)
    • hasVisitMethodMatching

      default <F> Boolean hasVisitMethodMatching(F target)
      Checks if the specified visitor has a visit method compatible with the specified fluent.
      Type Parameters:
      F - The type of the candidate
      Parameters:
      target - The candidate to check if current visitor can visit.
      Returns:
      True if matching method was found.
    • order

      default int order()
      Gets the processing order for this visitor. Visitors with lower order values are processed first.
      Returns:
      the order value, defaults to 0
    • addRequirement

      default <P> Visitor<T> addRequirement(Class<P> type, Predicate<P> predicate)
    • addRequirement

      default Visitor<T> addRequirement(Predicate predicate)