abstract class AnnotationsScanner
extends java.lang.Object
AnnotatedElement
.AnnotationsProcessor
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Class<?>,java.lang.reflect.Method[]> |
baseTypeMethodsCache |
private static java.util.Map<java.lang.reflect.AnnotatedElement,java.lang.annotation.Annotation[]> |
declaredAnnotationCache |
private static java.lang.annotation.Annotation[] |
NO_ANNOTATIONS |
private static java.lang.reflect.Method[] |
NO_METHODS |
Modifier | Constructor and Description |
---|---|
private |
AnnotationsScanner() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
clearCache() |
private static <C> java.lang.reflect.Method[] |
getBaseTypeMethods(C context,
java.lang.Class<?> baseType,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
(package private) static <A extends java.lang.annotation.Annotation> |
getDeclaredAnnotation(java.lang.reflect.AnnotatedElement source,
java.lang.Class<A> annotationType) |
(package private) static java.lang.annotation.Annotation[] |
getDeclaredAnnotations(java.lang.reflect.AnnotatedElement source,
boolean defensive) |
private static <C,R> java.lang.annotation.Annotation[] |
getDeclaredAnnotations(C context,
java.lang.reflect.AnnotatedElement source,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter,
boolean copy) |
(package private) static boolean |
hasPlainJavaAnnotationsOnly(java.lang.Class<?> type) |
(package private) static boolean |
hasPlainJavaAnnotationsOnly(java.lang.Object annotatedElement) |
private static boolean |
hasSameGenericTypeParameters(java.lang.reflect.Method rootMethod,
java.lang.reflect.Method candidateMethod,
java.lang.Class<?>[] rootParameterTypes) |
private static boolean |
hasSameParameterTypes(java.lang.reflect.Method rootMethod,
java.lang.reflect.Method candidateMethod) |
private static <C> boolean |
isFiltered(java.lang.Class<?> sourceClass,
C context,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static boolean |
isIgnorable(java.lang.Class<?> annotationType) |
(package private) static boolean |
isKnownEmpty(java.lang.reflect.AnnotatedElement source,
MergedAnnotations.SearchStrategy searchStrategy) |
private static boolean |
isOverride(java.lang.reflect.Method rootMethod,
java.lang.reflect.Method candidateMethod) |
private static boolean |
isWithoutHierarchy(java.lang.reflect.AnnotatedElement source) |
private static <C,R> R |
process(C context,
java.lang.reflect.AnnotatedElement source,
MergedAnnotations.SearchStrategy searchStrategy,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processClass(C context,
java.lang.Class<?> source,
MergedAnnotations.SearchStrategy searchStrategy,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processClassHierarchy(C context,
int[] aggregateIndex,
java.lang.Class<?> source,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter,
boolean includeInterfaces) |
private static <C,R> R |
processClassInheritedAnnotations(C context,
java.lang.Class<?> source,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processElement(C context,
java.lang.reflect.AnnotatedElement source,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processMethod(C context,
java.lang.reflect.Method source,
MergedAnnotations.SearchStrategy searchStrategy,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processMethodAnnotations(C context,
int aggregateIndex,
java.lang.reflect.Method source,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
private static <C,R> R |
processMethodHierarchy(C context,
int[] aggregateIndex,
java.lang.Class<?> sourceClass,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter,
java.lang.reflect.Method rootMethod,
boolean includeInterfaces) |
private static <C,R> R |
processMethodInheritedAnnotations(C context,
java.lang.reflect.Method source,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter) |
(package private) static <C,R> R |
scan(C context,
java.lang.reflect.AnnotatedElement source,
MergedAnnotations.SearchStrategy searchStrategy,
AnnotationsProcessor<C,R> processor)
Scan the hierarchy of the specified element for relevant annotations and
call the processor as required.
|
(package private) static <C,R> R |
scan(C context,
java.lang.reflect.AnnotatedElement source,
MergedAnnotations.SearchStrategy searchStrategy,
AnnotationsProcessor<C,R> processor,
java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
Scan the hierarchy of the specified element for relevant annotations and
call the processor as required.
|
private static final java.lang.annotation.Annotation[] NO_ANNOTATIONS
private static final java.lang.reflect.Method[] NO_METHODS
private static final java.util.Map<java.lang.reflect.AnnotatedElement,java.lang.annotation.Annotation[]> declaredAnnotationCache
private static final java.util.Map<java.lang.Class<?>,java.lang.reflect.Method[]> baseTypeMethodsCache
@Nullable static <C,R> R scan(C context, java.lang.reflect.AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C,R> processor)
context
- an optional context object that will be passed back to the
processorsource
- the source element to scansearchStrategy
- the search strategy to useprocessor
- the processor that receives the annotationsAnnotationsProcessor.finish(Object)
@Nullable static <C,R> R scan(C context, java.lang.reflect.AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
context
- an optional context object that will be passed back to the
processorsource
- the source element to scansearchStrategy
- the search strategy to useprocessor
- the processor that receives the annotationsclassFilter
- an optional filter that can be used to entirely filter
out a specific class from the hierarchyAnnotationsProcessor.finish(Object)
@Nullable private static <C,R> R process(C context, java.lang.reflect.AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processClass(C context, java.lang.Class<?> source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processClassInheritedAnnotations(C context, java.lang.Class<?> source, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processClassHierarchy(C context, int[] aggregateIndex, java.lang.Class<?> source, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter, boolean includeInterfaces)
@Nullable private static <C,R> R processMethod(C context, java.lang.reflect.Method source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processMethodInheritedAnnotations(C context, java.lang.reflect.Method source, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processMethodHierarchy(C context, int[] aggregateIndex, java.lang.Class<?> sourceClass, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter, java.lang.reflect.Method rootMethod, boolean includeInterfaces)
private static <C> java.lang.reflect.Method[] getBaseTypeMethods(C context, java.lang.Class<?> baseType, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
private static boolean isOverride(java.lang.reflect.Method rootMethod, java.lang.reflect.Method candidateMethod)
private static boolean hasSameParameterTypes(java.lang.reflect.Method rootMethod, java.lang.reflect.Method candidateMethod)
private static boolean hasSameGenericTypeParameters(java.lang.reflect.Method rootMethod, java.lang.reflect.Method candidateMethod, java.lang.Class<?>[] rootParameterTypes)
@Nullable private static <C,R> R processMethodAnnotations(C context, int aggregateIndex, java.lang.reflect.Method source, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
@Nullable private static <C,R> R processElement(C context, java.lang.reflect.AnnotatedElement source, AnnotationsProcessor<C,R> processor, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
private static <C,R> java.lang.annotation.Annotation[] getDeclaredAnnotations(C context, java.lang.reflect.AnnotatedElement source, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter, boolean copy)
@Nullable static <A extends java.lang.annotation.Annotation> A getDeclaredAnnotation(java.lang.reflect.AnnotatedElement source, java.lang.Class<A> annotationType)
static java.lang.annotation.Annotation[] getDeclaredAnnotations(java.lang.reflect.AnnotatedElement source, boolean defensive)
private static <C> boolean isFiltered(java.lang.Class<?> sourceClass, C context, @Nullable java.util.function.BiPredicate<C,java.lang.Class<?>> classFilter)
private static boolean isIgnorable(java.lang.Class<?> annotationType)
static boolean isKnownEmpty(java.lang.reflect.AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy)
static boolean hasPlainJavaAnnotationsOnly(@Nullable java.lang.Object annotatedElement)
static boolean hasPlainJavaAnnotationsOnly(java.lang.Class<?> type)
private static boolean isWithoutHierarchy(java.lang.reflect.AnnotatedElement source)
static void clearCache()