Interface ReflectionTools.ClassVisitor<T>
- Type Parameters:
T- The type of result of this visitor.
- All Superinterfaces:
BiFunction<Class<?>,T, T>
- Enclosing class:
- ReflectionTools
Interface for visiting a class hierarchy and accumulating the result. The visit of further
classes of the hierarchy can be aborted any time.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanabortVisit(T result) Whether to abort the visit of further classes since the result is already satisfying.default TVisits the designated class with the result so far.static <T> ReflectionTools.ClassVisitor<T>visitAllWith(BiFunction<Class<?>, T, T> biFunct) Creates a visitor that visits all classes with the designatedBiFunction.static ReflectionTools.ClassVisitor<Boolean>visitUntilTrue(Function<Class<?>, Boolean> funct) Creates a visitor that visits all classes until the designatedFunctionreturnstrue.Methods inherited from interface java.util.function.BiFunction
andThen
-
Method Details
-
apply
- Specified by:
applyin interfaceBiFunction<Class<?>,T, T>
-
visit
Visits the designated class with the result so far. The new result is returned after the visit.- Parameters:
cls- The visited class.result- The result before the visit.- Returns:
- The result after the visit.
-
abortVisit
Whether to abort the visit of further classes since the result is already satisfying.Per default this visitor will visit all classes and not abort early.
- Parameters:
result- The result accumulated by the previous visits.- Returns:
- Whether to abort visiting the rest of the class hierarchy.
-
visitAllWith
Creates a visitor that visits all classes with the designatedBiFunction. Note that at the first call the second parameter (result) will benull. So theBiFunctionusually has to create a corresponding result instance.- Parameters:
biFunct- TheBiFunctionto be applied when visiting classes.- Returns:
- A visitor that visits all classes with the designated
BiFunction.
-
visitUntilTrue
Creates a visitor that visits all classes until the designatedFunctionreturnstrue.- Parameters:
funct- TheFunctionto be applied when visiting classes.- Returns:
- A visitor that visits all classes with the designated
Functionuntil the function returnstrue.
-