Interface ClasspathScanner

All Known Implementing Classes:
DefaultClasspathScanner

@API(status=EXPERIMENTAL, since="1.12") public 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 Details

    • scanForClassesInPackage

      List<Class<?>> scanForClassesInPackage(String basePackageName, ClassFilter classFilter)
      Find all classes in the supplied classpath root that match the specified classFilter 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 be null and must be valid in terms of Java syntax
      classFilter - the class type filter; never null
      Returns:
      a list of all such classes found; never null but potentially empty
    • scanForClassesInClasspathRoot

      List<Class<?>> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter)
      Find all classes in the supplied classpath root that match the specified classFilter 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; never null
      classFilter - the class type filter; never null
      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 classpath root that match the specified resourceFilter 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 be null and must be valid in terms of Java syntax
      resourceFilter - the resource type filter; never null
      Returns:
      a list of all such resources found; never null but potentially empty
    • scanForResourcesInClasspathRoot

      List<Resource> scanForResourcesInClasspathRoot(URI root, Predicate<Resource> resourceFilter)
      Find all resources in the supplied classpath root that match the specified resourceFilter 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; never null
      resourceFilter - the resource type filter; never null
      Returns:
      a list of all such resources found; never null but potentially empty