@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.
Constructor and Description |
---|
ClassPathAnnotationScanner()
Default constructor.
|
ClassPathAnnotationScanner(ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
protected List<Class<?>> |
doScan(String annotation,
String pkg) |
protected ClassPathAnnotationScanner |
includeJars(boolean includeJars)
Whether to include JAR files.
|
Stream<Class<?>> |
scan(String annotation,
String pkg)
Scan the given packages.
|
protected void |
scanFile(String annotation,
Path filePath,
List<Class<?>> classes) |
protected void |
traverseFile(String annotation,
List<Class<?>> classes,
Path filePath) |
public ClassPathAnnotationScanner(ClassLoader classLoader)
classLoader
- The class loaderpublic ClassPathAnnotationScanner()
protected ClassPathAnnotationScanner includeJars(boolean includeJars)
includeJars
- The jar files to includepublic Stream<Class<?>> scan(String annotation, String pkg)
scan
in interface AnnotationScanner
annotation
- The annotation to scan forpkg
- The package to scanprotected List<Class<?>> doScan(String annotation, String pkg)
annotation
- The annotationpkg
- The packageprotected void traverseFile(String annotation, List<Class<?>> classes, Path filePath)
annotation
- The annotationclasses
- The classesfilePath
- The filePath