Class 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
    • 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