Package step.core.scanner
Class AnnotationScanner
- java.lang.Object
-
- step.core.scanner.AnnotationScanner
-
- All Implemented Interfaces:
AutoCloseable
public class AnnotationScanner extends Object implements AutoCloseable
-
-
Method Summary
-
-
-
Method Detail
-
forAllClassesFromContextClassLoader
public static AnnotationScanner forAllClassesFromContextClassLoader()
- Returns:
- an instance of
AnnotationScanner
scanning all classes of the context class loader
-
forAllClassesFromClassLoader
public static AnnotationScanner forAllClassesFromClassLoader(ClassLoader classloader)
- Parameters:
classloader
- theClassLoader
(including parents) to be scanned- Returns:
- an instance of
AnnotationScanner
scanning all classes of the provided class loader
-
forAllClassesFromClassLoader
public static AnnotationScanner forAllClassesFromClassLoader(String packagePrefix, ClassLoader classloader)
- Parameters:
packagePrefix
- the specific package to be scannedclassloader
- theClassLoader
(including parents) to be scanned- Returns:
- an instance of
AnnotationScanner
scanning all classes of the provided class loader
-
forSpecificJar
public static AnnotationScanner forSpecificJar(File jar)
- Parameters:
jar
- the specific jar file to be scanned- Returns:
- an instance of
AnnotationScanner
scanning all classes of the provided jar file
-
forSpecificJar
public static AnnotationScanner forSpecificJar(File jar, ClassLoader classLoaderForResultClassesAndMethods)
-
forSpecificJarFromURLClassLoader
public static AnnotationScanner forSpecificJarFromURLClassLoader(URLClassLoader classloader)
Scans the jar files of a specificURLClassLoader
- Parameters:
classloader
- the specificClassLoader
to scan theURL
s of- Returns:
- an instance of
AnnotationScanner
scanning all classes of the providedURLClassLoader
(parent excluded)
-
forSpecificJarFromURLClassLoader
public static AnnotationScanner forSpecificJarFromURLClassLoader(URLClassLoader classloader, ClassLoader classLoaderForResultClassesAndMethods)
Scans the jar files of a specificURLClassLoader
- Parameters:
classloader
- the specificClassLoader
to scan theURL
sclassLoaderForResultClassesAndMethods
- theClassLoader
containing the context- Returns:
- an instance of
AnnotationScanner
scanning all classes of the providedURLClassLoader
(parent excluded)
-
getClassesWithAnnotation
public Set<Class<?>> getClassesWithAnnotation(Class<? extends Annotation> annotationClass)
Get all classes annotated by the providedAnnotation
- Parameters:
annotationClass
-- Returns:
- the
Set
of classes annotated by the providedAnnotation
-
getMethodsWithAnnotation
public Set<Method> getMethodsWithAnnotation(Class<? extends Annotation> annotationClass)
Get all methods annotated by the providedAnnotation
- Parameters:
annotationClass
-- Returns:
- the
Set
of methods annotated by the providedAnnotation
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-