Class CachedAnnotationScanner


  • public class CachedAnnotationScanner
    extends java.lang.Object
    This classes provides a list of static methods delegating annotation scanning to AnnotationScanner and caching its results. A cache entry for each combination of packagePrefix and ClassLoader 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
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clearCache()  
      static java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)  
      static java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.ClassLoader classloader)  
      static java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.String packagePrefix, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.ClassLoader classloader)  
      static java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)  
      static java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.ClassLoader classloader)  
      static java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.String packagePrefix, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.ClassLoader classloader)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachedAnnotationScanner

        public CachedAnnotationScanner()
    • Method Detail

      • getClassesWithAnnotation

        public static java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                                                                 java.lang.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 java.util.Set<java.lang.Class<?>> getClassesWithAnnotation​(java.lang.String packagePrefix,
                                                                                 java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                                                                 java.lang.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 java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.Class<? extends java.lang.annotation.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 java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                                                                       java.lang.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 java.util.Set<java.lang.reflect.Method> getMethodsWithAnnotation​(java.lang.String packagePrefix,
                                                                                       java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                                                                       java.lang.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()