org.qi4j.bootstrap

## Class ClassScanner

- java.lang.Object
- - org.qi4j.bootstrap.ClassScanner

-     public class ClassScanner
      extends Object

  Scan classpath for classes that matches given criteria. Useful for automated assemblies with lots of similar classes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassScanner()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Iterable<Class<?>>` | `findClasses(Class<?> seedClass)` Get all classes from the same package of the given class, and recursively in all subpackages.
    `static Specification<Class<?>>` | `matches(String regex)` Useful specification for filtering classes based on a regular expression matching the class names.

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

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

- - ### Constructor Detail

    - #### ClassScanner

          public ClassScanner()

  - ### Method Detail

    - #### findClasses

          public static Iterable<Class<?>> findClasses(Class<?> seedClass)

      Get all classes from the same package of the given class, and recursively in all subpackages.

      This only works if the seed class is loaded from a file: URL. Jar files are possible as well. Abstract classes are not included in the results. For further filtering use e.g. Iterables.filter.

      Parameters:
        `seedClass` - starting point for classpath scanning
      Returns:
        iterable of all concrete classes in the same package as the seedclass, and also all classes in subpackages.

    - #### matches

          public static Specification<Class<?>> matches(String regex)

      Useful specification for filtering classes based on a regular expression matching the class names.

      Example: matches(".*Model") -> match only class names that end with Model

      Parameters:
        `regex` - The regular expression to be matched.
      Returns:
        regex class name specification