Package io.vertigo.core.lang
Class ClassSelector
java.lang.Object
io.vertigo.core.lang.ClassSelector
Utility class for selecting and filtering classes through reflection.
Provides a fluent API for:
- 1. Defining class scope by packages or explicit classes
- 2. Filtering classes, methods and fields by predicates
- 3. Finding matching elements with type safety
- Supporting annotation-based filtering
- Enabling component scanning and introspection
Usage example:
ClassSelector.from("com.example")
.filterClasses(ClassConditions.annotatedWith(MyAnnotation.class))
.filterMethods(MethodConditions.annotatedWith(MyMethodAnnotation.class))
.findMethods();
- Author:
- mlaroche
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classUtility class for class selection predicates.static final classUtility class for field selection predicates.static final classUtility class for method selection predicates. -
Method Summary
Modifier and TypeMethodDescriptionfilterClasses(Predicate<Class> classPredicate) Filters classes with a predicate.filterFields(Predicate<Field> fieldPredicate) Filters field with a predicate.filterMethods(Predicate<Method> methodPredicate) Filters method with a predicate.Find the classes matching the requirements and with method matching the requirements.Finds the fields matching the requirements with the associatedClass.Find the methods matching the requirements and with method matching the requirements.static ClassSelectorAdds a class to the scope.static ClassSelectorAdds all the classes with a package prefix in the scope.static ClassSelectorfrom(Collection<Class> classes) Adds a set of classes to the scope.
-
Method Details
-
from
Adds a set of classes to the scope.- Parameters:
classes- a supplier of classes- Returns:
- the selector
-
from
Adds a class to the scope.- Parameters:
clazz- the class to add- Returns:
- the selector
-
from
Adds all the classes with a package prefix in the scope.- Parameters:
packageName- the root package- Returns:
- the selector
-
filterFields
Filters field with a predicate.- Parameters:
fieldPredicate- the predicate- Returns:
- the selector
-
filterMethods
Filters method with a predicate.- Parameters:
methodPredicate- the predicate- Returns:
- the selector
-
filterClasses
Filters classes with a predicate.- Parameters:
classPredicate- the predicate- Returns:
- the selector
-
findClasses
Find the classes matching the requirements and with method matching the requirements.- Returns:
- the classes matching the selector
-
findMethods
Find the methods matching the requirements and with method matching the requirements.- Returns:
- the classes matching the selector
-
findFields
Finds the fields matching the requirements with the associatedClass.- Returns:
- the classes matching the selector
-