Class AnnotationMethodScanner<MethodAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>,​ParamAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>>

  • Type Parameters:
    MethodAnno - Annotation class used on method
    ParamAnno - Annotation class used on method parameter

    public class AnnotationMethodScanner<MethodAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>,​ParamAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>>
    extends java.lang.Object
    Scan a Class for Annotation and return result in an inner Multimap that you can cache.
    Since:
    1.0.1
    See Also:
    Rely on Spring AnnotationUtils, Moved from log-platform project
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger LOGGER  
      private java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass  
      private java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AnnotationMethodScanner​(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)
      Use of(Class, Class) instead.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static java.util.Map<java.lang.String,​java.lang.Object> getAnnotationAttributes​(java.lang.annotation.Annotation annotation)  
      (package private) static java.lang.annotation.Annotation[] getAnnotationFromParams​(java.lang.reflect.Method method, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)  
      static <M extends java.lang.Class<? extends java.lang.annotation.Annotation>,​P extends java.lang.Class<? extends java.lang.annotation.Annotation>>
      AnnotationMethodScanner<M,​P>
      of​(M methodAnnotationClass, P paramAnnotationClass)
      Create an AnnotationMethodScanner by capturing Annotation class annotated on Method and on Parameter.
      <M extends java.lang.Class<? extends java.lang.annotation.Annotation>,​P extends java.lang.Class<? extends java.lang.annotation.Annotation>>
      com.google.common.collect.Multimap<java.lang.String,​AnnotationMethodScan<M,​P>>
      scan​(java.lang.Class<?> targetClass)
      Scan all Method of this Class for annotation class 'MethodAnno' extract nested annotations and annotations on Parameter of annotation class 'ParamAnno'.
      AnnotationMethodScan scan​(java.lang.reflect.Method method)
      Scan a Method for annotation class 'MethodAnno' and extract nested annotations and for annotations on Parameter of annotation class 'ParamAnno'.
      static AnnotationMethodScan scan​(java.lang.reflect.Method method, java.lang.annotation.Annotation methodAnnotation, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)  
      static AnnotationMethodScan scan​(java.lang.reflect.Method method, java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)  
      • Methods inherited from class java.lang.Object

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

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • methodAnnotationClass

        private java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass
      • paramAnnotationClass

        private java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass
    • Constructor Detail

      • AnnotationMethodScanner

        private AnnotationMethodScanner​(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass,
                                        java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)
        Use of(Class, Class) instead.
        Parameters:
        methodAnnotationClass - Annotation class used on method
        paramAnnotationClass - Annotation class used on method parameter
    • Method Detail

      • of

        public static <M extends java.lang.Class<? extends java.lang.annotation.Annotation>,​P extends java.lang.Class<? extends java.lang.annotation.Annotation>> AnnotationMethodScanner<M,​P> of​(M methodAnnotationClass,
                                                                                                                                                                                                              P paramAnnotationClass)
        Create an AnnotationMethodScanner by capturing Annotation class annotated on Method and on Parameter.
        Type Parameters:
        M - Annotation class used on method
        P - Annotation class used on method parameter
        Parameters:
        methodAnnotationClass - Annotation class at method level.
        paramAnnotationClass - Annotation class at parameter level.
        Returns:
        Instance of AnnotationMethodScanner
      • scan

        public AnnotationMethodScan scan​(java.lang.reflect.Method method)
        Scan a Method for annotation class 'MethodAnno' and extract nested annotations and for annotations on Parameter of annotation class 'ParamAnno'.
        Parameters:
        method - Instance of the method to scan
        Returns:
        An object containing all the found annotations on this method.
      • scan

        public static AnnotationMethodScan scan​(java.lang.reflect.Method method,
                                                java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass,
                                                java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)
      • scan

        public static AnnotationMethodScan scan​(java.lang.reflect.Method method,
                                                java.lang.annotation.Annotation methodAnnotation,
                                                java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)
      • scan

        public <M extends java.lang.Class<? extends java.lang.annotation.Annotation>,​P extends java.lang.Class<? extends java.lang.annotation.Annotation>> com.google.common.collect.Multimap<java.lang.String,​AnnotationMethodScan<M,​P>> scan​(java.lang.Class<?> targetClass)
        Scan all Method of this Class for annotation class 'MethodAnno' extract nested annotations and annotations on Parameter of annotation class 'ParamAnno'.
        Type Parameters:
        M - Annotation class used on method
        P - Annotation class used on method parameter
        Parameters:
        targetClass - Class to scan for annotation 'MethodAnno'
        Returns:
        An object containing all the found annotation on this method.
      • getAnnotationAttributes

        static java.util.Map<java.lang.String,​java.lang.Object> getAnnotationAttributes​(java.lang.annotation.Annotation annotation)
      • getAnnotationFromParams

        static java.lang.annotation.Annotation[] getAnnotationFromParams​(java.lang.reflect.Method method,
                                                                         java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)
        Parameters:
        method - Instance of the method to scan
        paramAnnotationClass - Annotation class that marks a parameter
        Returns:
        Array of annotation parameter if paramAnnotationClass used. Else return empty array if nothing found.