Package io.micronaut.ast.groovy.scan
Class ClassPathAnnotationScanner
java.lang.Object
io.micronaut.ast.groovy.scan.ClassPathAnnotationScanner
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ClassPathAnnotationScanner
includeJars
(boolean includeJars) Whether to include JAR files.Scan the given packages.protected void
protected void
traverseFile
(String annotation, List<Class<?>> classes, Path filePath)
-
Constructor Details
-
ClassPathAnnotationScanner
- Parameters:
classLoader
- The class loader
-
ClassPathAnnotationScanner
public ClassPathAnnotationScanner()Default constructor.
-
-
Method Details
-
includeJars
Whether to include JAR files.- Parameters:
includeJars
- The jar files to include- Returns:
- This scanner
-
scan
@NonNull public @NonNull Stream<Class<?>> scan(@NonNull @NonNull String annotation, @NonNull @NonNull String pkg) Scan the given packages.- Specified by:
scan
in interfaceAnnotationScanner
- Parameters:
annotation
- The annotation to scan forpkg
- The package to scan- Returns:
- A stream of classes
-
doScan
- Parameters:
annotation
- The annotationpkg
- The package- Returns:
- The list of class
-
traverseFile
- Parameters:
annotation
- The annotationclasses
- The classesfilePath
- The filePath
-
scanFile
- Parameters:
annotation
- The annotationfilePath
- The file pathclasses
- The classes
-