Class DefaultClasspathScanner
java.lang.Object
org.junit.platform.commons.support.scanning.DefaultClasspathScanner
- All Implemented Interfaces:
ClasspathScanner
@API(status=INTERNAL,
since="1.12")
public class DefaultClasspathScanner
extends Object
implements ClasspathScanner
DISCLAIMER
These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultClasspathScanner(Supplier<ClassLoader> classLoaderSupplier, BiFunction<String, ClassLoader, Try<Class<?>>> loadClass) -
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 classpathrootthat match the specifiedresourceFilterpredicate.scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) Find all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.
-
Constructor Details
-
DefaultClasspathScanner
public DefaultClasspathScanner(Supplier<ClassLoader> classLoaderSupplier, BiFunction<String, ClassLoader, Try<Class<?>>> loadClass)
-
-
Method Details
-
scanForClassesInPackage
Description copied from interface:ClasspathScannerFind all classes in the supplied classpathrootthat match the specifiedclassFilterfilter.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Specified by:
scanForClassesInPackagein interfaceClasspathScanner- Parameters:
basePackageName- the name of the base package in which to start scanning; must not benulland must be valid in terms of Java syntaxclassFilter- the class type filter; nevernull- Returns:
- a list of all such classes found; never
nullbut potentially empty
-
scanForClassesInClasspathRoot
Description copied from interface:ClasspathScannerFind all classes in the supplied classpathrootthat match the specifiedclassFilterfilter.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Specified by:
scanForClassesInClasspathRootin interfaceClasspathScanner- Parameters:
root- the URI for the classpath root in which to scan; nevernullclassFilter- the class type filter; nevernull- Returns:
- a list of all such classes found; never
nullbut potentially empty
-
scanForResourcesInPackage
public List<Resource> scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) Description copied from interface:ClasspathScannerFind all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Specified by:
scanForResourcesInPackagein interfaceClasspathScanner- Parameters:
basePackageName- the name of the base package in which to start scanning; must not benulland must be valid in terms of Java syntaxresourceFilter- the resource type filter; nevernull- Returns:
- a list of all such resources found; never
nullbut potentially empty
-
scanForResourcesInClasspathRoot
Description copied from interface:ClasspathScannerFind all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.The classpath scanning algorithm searches recursively in subpackages beginning with the root of the classpath.
- Specified by:
scanForResourcesInClasspathRootin interfaceClasspathScanner- Parameters:
root- the URI for the classpath root in which to scan; nevernullresourceFilter- the resource type filter; nevernull- Returns:
- a list of all such resources found; never
nullbut potentially empty
-