Class ClassPathAnnotationScanner

java.lang.Object
io.micronaut.ast.groovy.scan.ClassPathAnnotationScanner
All Implemented Interfaces:
AnnotationScanner

@Internal public class ClassPathAnnotationScanner extends Object implements AnnotationScanner

An optimized classpath scanner that includes the ability to optionally scan JAR files.

The implementation avoids loading the classes themselves by parsing the class definitions and reading only the annotations.

Since:
1.0
Author:
Graeme Rocher
  • Constructor Details

    • ClassPathAnnotationScanner

      public ClassPathAnnotationScanner(ClassLoader classLoader)
      Parameters:
      classLoader - The class loader
    • ClassPathAnnotationScanner

      public ClassPathAnnotationScanner()
      Default constructor.
  • Method Details

    • includeJars

      protected ClassPathAnnotationScanner includeJars(boolean includeJars)
      Whether to include JAR files.
      Parameters:
      includeJars - The jar files to include
      Returns:
      This scanner
    • scan

      public Stream<Class<?>> scan(String annotation, String pkg)
      Scan the given packages.
      Specified by:
      scan in interface AnnotationScanner
      Parameters:
      annotation - The annotation to scan for
      pkg - The package to scan
      Returns:
      A stream of classes
    • doScan

      protected List<Class<?>> doScan(String annotation, String pkg)
      Parameters:
      annotation - The annotation
      pkg - The package
      Returns:
      The list of class
    • traverseFile

      protected void traverseFile(String annotation, List<Class<?>> classes, Path filePath)
      Parameters:
      annotation - The annotation
      classes - The classes
      filePath - The filePath
    • scanFile

      protected void scanFile(String annotation, Path filePath, List<Class<?>> classes)
      Parameters:
      annotation - The annotation
      filePath - The file path
      classes - The classes