Module org.junit.platform.commons
Interface ClasspathScanner
- All Known Implementing Classes:
DefaultClasspathScanner
ClasspathScanner
allows to scan the classpath for classes and
resources.
An implementation of this interface can be registered via the
ServiceLoader
mechanism.
- Since:
- 1.12
-
Method Summary
Modifier and TypeMethodDescriptionscanForClassesInClasspathRoot
(URI root, ClassFilter classFilter) scanForClassesInPackage
(String basePackageName, ClassFilter classFilter) scanForResourcesInClasspathRoot
(URI root, Predicate<Resource> resourceFilter) Find all resources in the supplied classpathroot
that match the specifiedresourceFilter
predicate.scanForResourcesInPackage
(String basePackageName, Predicate<Resource> resourceFilter) Find all resources in the supplied classpathroot
that match the specifiedresourceFilter
predicate.
-
Method Details
-
scanForClassesInPackage
Find all classes in the supplied classpathroot
that match the specifiedclassFilter
filter.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Parameters:
basePackageName
- the name of the base package in which to start scanning; must not benull
and must be valid in terms of Java syntaxclassFilter
- the class type filter; nevernull
- Returns:
- a list of all such classes found; never
null
but potentially empty
-
scanForClassesInClasspathRoot
Find all classes in the supplied classpathroot
that match the specifiedclassFilter
filter.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Parameters:
root
- the URI for the classpath root in which to scan; nevernull
classFilter
- the class type filter; nevernull
- Returns:
- a list of all such classes found; never
null
but potentially empty
-
scanForResourcesInPackage
List<Resource> scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) Find all resources in the supplied classpathroot
that match the specifiedresourceFilter
predicate.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Parameters:
basePackageName
- the name of the base package in which to start scanning; must not benull
and must be valid in terms of Java syntaxresourceFilter
- the resource type filter; nevernull
- Returns:
- a list of all such resources found; never
null
but potentially empty
-
scanForResourcesInClasspathRoot
Find all resources in the supplied classpathroot
that match the specifiedresourceFilter
predicate.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Parameters:
root
- the URI for the classpath root in which to scan; nevernull
resourceFilter
- the resource type filter; nevernull
- Returns:
- a list of all such resources found; never
null
but potentially empty
-