Interface ClasspathScanner
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) Deprecated, for removal: This API element is subject to removal in a future version.scanForResourcesInClasspathRoot(URI root, ResourceFilter resourceFilter) Find all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) Deprecated, for removal: This API element is subject to removal in a future version.Please implementscanForResourcesInPackage(String, ResourceFilter)insteadscanForResourcesInPackage(String basePackageName, ResourceFilter resourceFilter) Find all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.
-
Method Details
-
scanForClassesInPackage
Find all classes in the supplied classpathrootthat match the specifiedclassFilterfilter.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 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
Find all classes in the supplied classpathrootthat match the specifiedclassFilterfilter.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; nevernullclassFilter- the class type filter; nevernull- Returns:
- a list of all such classes found; never
nullbut potentially empty
-
scanForResourcesInPackage
@API(status=DEPRECATED, since="1.14") @Deprecated(since="1.14", forRemoval=true) default List<Resource> scanForResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) Deprecated, for removal: This API element is subject to removal in a future version.Please implementscanForResourcesInPackage(String, ResourceFilter)insteadFind all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.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 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
@API(status=DEPRECATED, since="1.14") @Deprecated(since="1.14", forRemoval=true) default List<Resource> scanForResourcesInClasspathRoot(URI root, Predicate<Resource> resourceFilter) Deprecated, for removal: This API element is subject to removal in a future version.Please implementscanForResourcesInClasspathRoot(URI, ResourceFilter)insteadFind all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.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; nevernullresourceFilter- the resource type filter; nevernull- Returns:
- a list of all such resources found; never
nullbut potentially empty
-
scanForResourcesInPackage
@API(status=MAINTAINED, since="1.14") default List<? extends Resource> scanForResourcesInPackage(String basePackageName, ResourceFilter resourceFilter) Find all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.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 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 - Since:
- 1.14
-
scanForResourcesInClasspathRoot
@API(status=MAINTAINED, since="1.14") default List<? extends Resource> scanForResourcesInClasspathRoot(URI root, ResourceFilter resourceFilter) Find all resources in the supplied classpathrootthat match the specifiedresourceFilterpredicate.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; nevernullresourceFilter- the resource type filter; nevernull- Returns:
- a list of all such resources found; never
nullbut potentially empty - Since:
- 1.14
-
scanForResourcesInClasspathRoot(URI, ResourceFilter)instead