Package step.core.scanner
Class CachedAnnotationScanner
- java.lang.Object
-
- step.core.scanner.CachedAnnotationScanner
-
public class CachedAnnotationScanner extends Object
This classes provides a list of static methods delegating annotation scanning toAnnotationScanner
and caching its results. A cache entry for each combination of packagePrefix andClassLoader
will be created. Calling this class for non-bounded sets of combinations will cause memory issues. Please be therefore aware of what you're doing when using this class
-
-
Constructor Summary
Constructors Constructor Description CachedAnnotationScanner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearCache()
static Set<Class<?>>
getClassesWithAnnotation(Class<? extends Annotation> annotationClass)
static Set<Class<?>>
getClassesWithAnnotation(Class<? extends Annotation> annotationClass, ClassLoader classloader)
static Set<Class<?>>
getClassesWithAnnotation(String packagePrefix, Class<? extends Annotation> annotationClass, ClassLoader classloader)
static Set<Method>
getMethodsWithAnnotation(Class<? extends Annotation> annotationClass)
static Set<Method>
getMethodsWithAnnotation(Class<? extends Annotation> annotationClass, ClassLoader classloader)
static Set<Method>
getMethodsWithAnnotation(String packagePrefix, Class<? extends Annotation> annotationClass, ClassLoader classloader)
-
-
-
Method Detail
-
getClassesWithAnnotation
public static Set<Class<?>> getClassesWithAnnotation(Class<? extends Annotation> annotationClass)
- Parameters:
annotationClass
-- Returns:
- a set of classes annotated by the provided annotation in the current context class loader. Warning: Results of this methods are cached. See Class comments for more details
-
getClassesWithAnnotation
public static Set<Class<?>> getClassesWithAnnotation(Class<? extends Annotation> annotationClass, ClassLoader classloader)
- Parameters:
annotationClass
-classloader
-- Returns:
- a set of classes annotated by the provided annotation in the provided class loader. Warning: Results of this methods are cached. See Class comments for more details
-
getClassesWithAnnotation
public static Set<Class<?>> getClassesWithAnnotation(String packagePrefix, Class<? extends Annotation> annotationClass, ClassLoader classloader)
- Parameters:
packagePrefix
-annotationClass
-classloader
-- Returns:
- a set of classes annotated by the provided annotation in the provided class loader and within the provided package. Warning: Results of this methods are cached. See Class comments for more details
-
getMethodsWithAnnotation
public static Set<Method> getMethodsWithAnnotation(Class<? extends Annotation> annotationClass)
- Parameters:
annotationClass
-- Returns:
- a set of methods annotated by the provided annotation in the current context class loader. Warning: Results of this methods are cached. See Class comments for more details
-
getMethodsWithAnnotation
public static Set<Method> getMethodsWithAnnotation(Class<? extends Annotation> annotationClass, ClassLoader classloader)
- Parameters:
annotationClass
-classloader
-- Returns:
- a set of methods annotated by the provided annotation in the provided class loader. Warning: Results of this methods are cached. See Class comments for more details
-
getMethodsWithAnnotation
public static Set<Method> getMethodsWithAnnotation(String packagePrefix, Class<? extends Annotation> annotationClass, ClassLoader classloader)
- Parameters:
packagePrefix
-annotationClass
-classloader
-- Returns:
- a set of classes annotated by the provided annotation in the provided class loader and within the provided package. Warning: Results of this methods are cached. See Class comments for more details
-
clearCache
public static void clearCache()
-
-