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 withfindMatchingClasses
method.classNameContaining
(String value) A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.classNameIsEqualTo
(String value) A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.classNameMatchesRegex
(String value) A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.static ClassFinder
Returns aClassFinder
, which checks all the classes underrootPackage
with a givenquery
predicate.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 withfindMatchingClasses
method.hasTagValueContaining
(String value) hasTagValueEqualTo
(String value) A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.hasTagValueMatchesRegex
(String value) isAssignableTo
(Class<?> klass) A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.
-
Method Details
-
findMatchingClasses
-
create
Returns aClassFinder
, which checks all the classes underrootPackage
with a givenquery
predicate.- Parameters:
rootPackage
- A root package.- Returns:
- A new
ClassFinder
object.
-
classNameIsEqualTo
A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.- 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 withfindMatchingClasses
method.- 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 withfindMatchingClasses
method.- 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 withfindMatchingClasses
method.- 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 withfindMatchingClasses
method.- Parameters:
annotationClasses
- classes from which the returned predicate is created.- Returns:
- A predicate which matches any of
annotationClasses
is present.
-
hasTagValueEqualTo
A utility method to return aPredicate
, which can be used withfindMatchingClasses
method.- Parameters:
value
- A string value from which the returned predicate is created.- Returns:
- A predicate which matches a class whose
@Tag
annotation value is equal tovalue
.
-
hasTagValueContaining
-
hasTagValueMatchesRegex
-
functionSimpleName
-