Interface ClassFinder
public interface ClassFinder
An interface to find classes on the class-path.
-
Method Summary
Modifier and TypeMethodDescriptionA utility method to return aPredicate, which can be used withfindMatchingClassesmethod.classNameContaining(String value) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.classNameIsEqualTo(String value) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.classNameMatchesRegex(String value) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.static ClassFinderReturns aClassFinder, which checks all the classes underrootPackagewith a givenquerypredicate.findMatchingClasses(Predicate<Class<?>> query) Returns a stream of classes on the class-path, each of which matches thequery.hasAnnotations(Class<? extends Annotation>... annotationClasses) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.hasTagValueContaining(String value) hasTagValueEqualTo(String value) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.hasTagValueMatchesRegex(String value) isAssignableTo(Class<?> klass) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.
-
Method Details
-
findMatchingClasses
-
create
Returns aClassFinder, which checks all the classes underrootPackagewith a givenquerypredicate.- Parameters:
rootPackage- A root package.- Returns:
- A new
ClassFinderobject.
-
classNameIsEqualTo
A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
value- A string value from which the returned predicate is created.- Returns:
- A predicate which matches a class whose name is equal to
value.
-
classNameContaining
A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
value- A string value from which the returned predicate is created.- Returns:
- A predicate which matches a class whose name is containing
value.
-
classNameMatchesRegex
A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
value- A string value from which the returned predicate is created.- Returns:
- A predicate which matches a class whose name matches a regular expression
value.
-
alwaysTrue
-
isAssignableTo
A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
klass- A class object from which the returned predicate is created.- Returns:
- A predicate which matches a class which is assignable from
klass.
-
hasAnnotations
@SafeVarargs static Predicate<Class<?>> hasAnnotations(Class<? extends Annotation>... annotationClasses) A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
annotationClasses- classes from which the returned predicate is created.- Returns:
- A predicate which matches any of
annotationClassesis present.
-
hasTagValueEqualTo
A utility method to return aPredicate, which can be used withfindMatchingClassesmethod.- Parameters:
value- A string value from which the returned predicate is created.- Returns:
- A predicate which matches a class whose
@Tagannotation value is equal tovalue.
-
hasTagValueContaining
-
hasTagValueMatchesRegex
-
functionSimpleName
-