Package org.apache.cxf.common.util

## Class ClasspathScanner

- java.lang.Object
- - org.apache.cxf.common.util.ClasspathScanner

-     public class ClasspathScanner
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `ALL_CLASS_FILES` |
    `static String` | `ALL_FILES` |
    `static String` | `CLASSPATH_URL_SCHEME` |
    `static String` | `WILDCARD` |

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `ClasspathScanner()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Map<Class<? extends Annotation>,​Collection<Class<?>>>` | `findClasses​(String basePackage, Class<? extends Annotation>... annotations)` | Scans list of base packages for all classes marked with specific annotations.
    `static Map<Class<? extends Annotation>,​Collection<Class<?>>>` | `findClasses​(Collection<String> basePackages, Class<? extends Annotation>... annotations)` | Scans list of base packages for all classes marked with specific annotations.
    `static Map<Class<? extends Annotation>,​Collection<Class<?>>>` | `findClasses​(Collection<String> basePackages, List<Class<? extends Annotation>> annotations)` | Scans list of base packages for all classes marked with specific annotations.
    `static Map<Class<? extends Annotation>,​Collection<Class<?>>>` | `findClasses​(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader)` |
    `protected Map<Class<? extends Annotation>,​Collection<Class<?>>>` | `findClassesInternal​(Collection<String> basePackages, List<Class<? extends Annotation>> annotations, ClassLoader loader)` |
    `static List<URL>` | `findResources​(String basePackage, String extension)` | Scans list of base packages for all resources with the given extension.
    `static List<URL>` | `findResources​(String basePackage, String extension, ClassLoader loader)` | Scans list of base packages for all resources with the given extension.
    `static List<URL>` | `findResources​(Collection<String> basePackages, String extension)` | Scans list of base packages for all resources with the given extension.
    `static List<URL>` | `findResources​(Collection<String> basePackages, String extension, ClassLoader loader)` |
    `protected List<URL>` | `findResourcesInternal​(Collection<String> basePackages, String extension, ClassLoader loader)` |
    `static Set<String>` | `parsePackages​(String packagesAsCsv)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALL_FILES

          public static final String ALL_FILES

      See Also:
        Constant Field Values

    - #### ALL_CLASS_FILES

          public static final String ALL_CLASS_FILES

      See Also:
        Constant Field Values

    - #### WILDCARD

          public static final String WILDCARD

      See Also:
        Constant Field Values

    - #### CLASSPATH_URL_SCHEME

          public static final String CLASSPATH_URL_SCHEME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ClasspathScanner

          protected ClasspathScanner()

  - ### Method Detail

    - #### findClasses

          @SafeVarargs
          public static Map<Class<? extends Annotation>,​Collection<Class<?>>> findClasses​(String basePackage,
                                                                                                Class<? extends Annotation>... annotations)
                                                                                         throws IOException,
                                                                                                ClassNotFoundException

      Scans list of base packages for all classes marked with specific annotations.
      Parameters:
        `basePackage` - base package
        `annotations` - annotations to discover
      Returns:
        all discovered classes grouped by annotations they belong too
      Throws:
        `IOException` - class metadata is not readable
        `ClassNotFoundException` - class not found

    - #### findClasses

          @SafeVarargs
          public static Map<Class<? extends Annotation>,​Collection<Class<?>>> findClasses​(Collection<String> basePackages,
                                                                                                Class<? extends Annotation>... annotations)
                                                                                         throws IOException,
                                                                                                ClassNotFoundException

      Scans list of base packages for all classes marked with specific annotations.
      Parameters:
        `basePackages` - list of base packages
        `annotations` - annotations to discover
      Returns:
        all discovered classes grouped by annotations they belong too
      Throws:
        `IOException` - class metadata is not readable
        `ClassNotFoundException` - class not found

    - #### findClasses

          public static Map<Class<? extends Annotation>,​Collection<Class<?>>> findClasses​(Collection<String> basePackages,
                                                                                                List<Class<? extends Annotation>> annotations)
                                                                                         throws IOException,
                                                                                                ClassNotFoundException

      Scans list of base packages for all classes marked with specific annotations.
      Parameters:
        `basePackages` - list of base packages
        `annotations` - annotations to discover
      Returns:
        all discovered classes grouped by annotations they belong too
      Throws:
        `IOException` - class metadata is not readable
        `ClassNotFoundException` - class not found

    - #### findClasses

          public static Map<Class<? extends Annotation>,​Collection<Class<?>>> findClasses​(Collection<String> basePackages,
                                                                                                List<Class<? extends Annotation>> annotations,
                                                                                                ClassLoader loader)
                                                                                         throws IOException,
                                                                                                ClassNotFoundException

      Throws:
        `IOException`
        `ClassNotFoundException`

    - #### findClassesInternal

          protected Map<Class<? extends Annotation>,​Collection<Class<?>>> findClassesInternal​(Collection<String> basePackages,
                                                                                                    List<Class<? extends Annotation>> annotations,
                                                                                                    ClassLoader loader)
                                                                                             throws IOException,
                                                                                                    ClassNotFoundException

      Throws:
        `IOException`
        `ClassNotFoundException`

    - #### findResources

          public static List<URL> findResources​(String basePackage,
                                                String extension)
                                         throws IOException

      Scans list of base packages for all resources with the given extension.
      Parameters:
        `basePackage` - base package
        `extension` - the extension matching resources needs to have
      Returns:
        list of all discovered resource URLs
      Throws:
        `IOException` - resource is not accessible

    - #### findResources

          public static List<URL> findResources​(String basePackage,
                                                String extension,
                                                ClassLoader loader)
                                         throws IOException

      Scans list of base packages for all resources with the given extension.
      Parameters:
        `basePackage` - base package
        `extension` - the extension matching resources needs to have
      Returns:
        list of all discovered resource URLs
      Throws:
        `IOException` - resource is not accessible

    - #### findResources

          public static List<URL> findResources​(Collection<String> basePackages,
                                                String extension)
                                         throws IOException

      Scans list of base packages for all resources with the given extension.
      Parameters:
        `basePackages` - list of base packages
        `extension` - the extension matching resources needs to have
      Returns:
        list of all discovered resource URLs
      Throws:
        `IOException` - resource is not accessible

    - #### findResources

          public static List<URL> findResources​(Collection<String> basePackages,
                                                String extension,
                                                ClassLoader loader)
                                         throws IOException

      Throws:
        `IOException`

    - #### parsePackages

          public static Set<String> parsePackages​(String packagesAsCsv)

    - #### findResourcesInternal

          protected List<URL> findResourcesInternal​(Collection<String> basePackages,
                                                    String extension,
                                                    ClassLoader loader)
                                             throws IOException

      Throws:
        `IOException`