Package io.sundr.builder
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.
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 Summary
Modifier and TypeMethodDescriptionaddRequirement(Class<P> type, Predicate<P> predicate) addRequirement(Predicate predicate) default <F> BooleanGets the requirement predicate for this visitor.getType()Gets the type of objects this visitor can handle.default <F> BooleanhasVisitMethodMatching(F target) Checks if the specified visitor has a visit method compatible with the specified fluent.default intorder()Gets the processing order for this visitor.default voidVisits the specified element with path information.voidVisits the specified element.
-
Method Details
-
visit
Visits the specified element.- Parameters:
element- the element to visit
-
visit
Visits the specified element with path information. By default, this delegates to the simple visit method.- Parameters:
path- the path to the element being visitedelement- the element to visit
-
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
-
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
-
hasVisitMethodMatching
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
-
addRequirement
-