Package io.vertigo.core.util
Class Selector
- java.lang.Object
-
- io.vertigo.core.util.Selector
-
public final class Selector extends Object
Selector of classes and methods. 1. Define a scope/set of classes - by addind them - by their packages 2. filter - classes - methods 3 - find your classes or methods.- Author:
- mlaroche
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Selector.ClassConditions
Conditions for selecting a class.static class
Selector.FieldConditions
Conditions for selecting a method.static class
Selector.MethodConditions
Conditions for selecting a method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Selector
filterClasses(Predicate<Class> classPredicate)
Filters classes with a predicate.Selector
filterFields(Predicate<Field> fieldPredicate)
Filters field with a predicate.Selector
filterMethods(Predicate<Method> methodPredicate)
Filters method with a predicate.Collection<Class>
findClasses()
Find the classes matching the requirements and with method matching the requirements.Collection<Tuple<Class,Field>>
findFields()
Finds the fields matching the requirements with the associatedClass.Collection<Tuple<Class,Method>>
findMethods()
Find the methods matching the requirements and with method matching the requirements.static Selector
from(Class clazz)
Adds a class to the scope.static Selector
from(String packageName)
Adds all the classes with a package prefix in the scope.static Selector
from(Collection<Class> classes)
Adds a set of classes to the scope.
-
-
-
Method Detail
-
from
public static Selector from(Collection<Class> classes)
Adds a set of classes to the scope.- Parameters:
classes
- a supplier of classes- Returns:
- the selector
-
from
public static Selector from(Class clazz)
Adds a class to the scope.- Parameters:
clazz
- the class to add- Returns:
- the selector
-
from
public static Selector from(String packageName)
Adds all the classes with a package prefix in the scope.- Parameters:
packageName
- the root package- Returns:
- the selector
-
filterFields
public Selector filterFields(Predicate<Field> fieldPredicate)
Filters field with a predicate.- Parameters:
fieldPredicate
- the predicate- Returns:
- the selector
-
filterMethods
public Selector filterMethods(Predicate<Method> methodPredicate)
Filters method with a predicate.- Parameters:
methodPredicate
- the predicate- Returns:
- the selector
-
filterClasses
public Selector filterClasses(Predicate<Class> classPredicate)
Filters classes with a predicate.- Parameters:
classPredicate
- the predicate- Returns:
- the selector
-
findClasses
public Collection<Class> findClasses()
Find the classes matching the requirements and with method matching the requirements.- Returns:
- the classes matching the selector
-
findMethods
public Collection<Tuple<Class,Method>> findMethods()
Find the methods matching the requirements and with method matching the requirements.- Returns:
- the classes matching the selector
-
findFields
public Collection<Tuple<Class,Field>> findFields()
Finds the fields matching the requirements with the associatedClass.- Returns:
- the classes matching the selector
-
-