Class AnnotationMethodScanner<MethodAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>,ParamAnno extends java.lang.Class<? extends java.lang.annotation.Annotation>>
- java.lang.Object
-
- com.github.frtu.spring.annotation.AnnotationMethodScanner<MethodAnno,ParamAnno>
-
- Type Parameters:
MethodAnno- Annotation class used on methodParamAnno- 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.ObjectScan aClassforAnnotationand return result in an innerMultimapthat 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.LoggerLOGGERprivate java.lang.Class<? extends java.lang.annotation.Annotation>methodAnnotationClassprivate java.lang.Class<? extends java.lang.annotation.Annotation>paramAnnotationClass
-
Constructor Summary
Constructors Modifier Constructor Description privateAnnotationMethodScanner(java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)Useof(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 anAnnotationMethodScannerby capturingAnnotationclass annotated onMethodand onParameter.<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 allMethodof thisClassfor annotation class 'MethodAnno' extract nested annotations and annotations onParameterof annotation class 'ParamAnno'.AnnotationMethodScanscan(java.lang.reflect.Method method)Scan aMethodfor annotation class 'MethodAnno' and extract nested annotations and for annotations onParameterof annotation class 'ParamAnno'.static AnnotationMethodScanscan(java.lang.reflect.Method method, java.lang.annotation.Annotation methodAnnotation, java.lang.Class<? extends java.lang.annotation.Annotation> paramAnnotationClass)static AnnotationMethodScanscan(java.lang.reflect.Method method, java.lang.Class<? extends java.lang.annotation.Annotation> methodAnnotationClass, 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)Useof(Class, Class)instead.- Parameters:
methodAnnotationClass- Annotation class used on methodparamAnnotationClass- 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 anAnnotationMethodScannerby capturingAnnotationclass annotated onMethodand onParameter.- Type Parameters:
M- Annotation class used on methodP- 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 aMethodfor annotation class 'MethodAnno' and extract nested annotations and for annotations onParameterof 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 allMethodof thisClassfor annotation class 'MethodAnno' extract nested annotations and annotations onParameterof annotation class 'ParamAnno'.- Type Parameters:
M- Annotation class used on methodP- 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 scanparamAnnotationClass- Annotation class that marks a parameter- Returns:
- Array of annotation parameter if paramAnnotationClass used. Else return empty array if nothing found.
-
-