Interface ClasspathScanner


  • @API(status=MAINTAINED,
         since="1.13.3")
    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 Detail

      • scanForClassesInPackage

        java.util.List<java.lang.Class<?>> scanForClassesInPackage​(java.lang.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

        java.util.List<java.lang.Class<?>> scanForClassesInClasspathRoot​(java.net.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

        @API(status=DEPRECATED,
             since="1.14")
        @Deprecated
        default java.util.List<Resource> scanForResourcesInPackage​(java.lang.String basePackageName,
                                                                   java.util.function.Predicate<Resource> resourceFilter)
        Deprecated.
        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

        @API(status=DEPRECATED,
             since="1.14")
        @Deprecated
        default java.util.List<Resource> scanForResourcesInClasspathRoot​(java.net.URI root,
                                                                         java.util.function.Predicate<Resource> resourceFilter)
        Deprecated.
        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
      • scanForResourcesInPackage

        @API(status=MAINTAINED,
             since="1.14")
        default java.util.List<? extends Resource> scanForResourcesInPackage​(java.lang.String basePackageName,
                                                                             ResourceFilter 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
        Since:
        1.14
      • scanForResourcesInClasspathRoot

        @API(status=MAINTAINED,
             since="1.14")
        default java.util.List<? extends Resource> scanForResourcesInClasspathRoot​(java.net.URI root,
                                                                                   ResourceFilter 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
        Since:
        1.14