Top Description Fields Constructors Methods
org.springframework.core.annotation

pack-priv abstract Class AnnotationsScanner

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.lang.reflect.AnnotatedElement, .Member, .Method, .Modifier, java.util.Arrays, .Map, java.util.function.Predicate, org.springframework.core.BridgeMethodResolver, .Ordered, .ResolvableType, org.springframework.core.annotation.MergedAnnotations.Search, .MergedAnnotations.SearchStrategy, org.springframework.lang.Nullable, org.springframework.util.ConcurrentReferenceHashMap, .ObjectUtils, .ReflectionUtils

Scanner to search for relevant annotations in the annotation hierarchy of an AnnotatedElement.
Authors
Phillip Webb, Sam Brannen
Since
5.2
See Also
AnnotationsProcessor

Field Summary

Modifier and TypeField and Description
private static final Map<Class<?>, Method[]>
private static final Map<AnnotatedElement, Annotation[]>
private static final Annotation[]
private static final Method[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
private static <C> Method[]
getBaseTypeMethods(C context, Class<?> baseType)

pack-priv static <A extends Annotation> A
getDeclaredAnnotation(AnnotatedElement source, Class<A> annotationType)

pack-priv static Annotation[]
getDeclaredAnnotations(AnnotatedElement source, boolean defensive)

pack-priv static boolean
pack-priv static boolean
private static boolean
hasSameGenericTypeParameters(Method rootMethod, Method candidateMethod, Class<?>[] rootParameterTypes)

private static boolean
hasSameParameterTypes(Method rootMethod, Method candidateMethod)

private static boolean
isIgnorable(Class<?> annotationType)

pack-priv static boolean
isKnownEmpty(AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass)

private static boolean
isOverride(Method rootMethod, Method candidateMethod)

private static boolean
isWithoutHierarchy(AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass)

private static <C, R> R
process(C context, AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processClass(C context, Class<?> source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processClassHierarchy(C context, Class<?> source, AnnotationsProcessor<C, R> processor, boolean includeInterfaces, Predicate<Class<?>> searchEnclosingClass)

private static <C, R> R
processClassHierarchy(C context, int[] aggregateIndex, Class<?> source, AnnotationsProcessor<C, R> processor, boolean includeInterfaces, Predicate<Class<?>> searchEnclosingClass)

private static <C, R> R
processClassInheritedAnnotations(C context, Class<?> source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processElement(C context, AnnotatedElement source, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processMethod(C context, Method source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processMethodAnnotations(C context, int aggregateIndex, Method source, AnnotationsProcessor<C, R> processor)

private static <C, R> R
processMethodHierarchy(C context, int[] aggregateIndex, Class<?> sourceClass, AnnotationsProcessor<C, R> processor, Method rootMethod, boolean includeInterfaces)

private static <C, R> R
pack-priv static <C, R> R
scan(C
an optional context object that will be passed back to the processor
context
,
AnnotatedElement
the source element to scan
source
,
MergedAnnotations.SearchStrategy
the search strategy to use
searchStrategy
,
Predicate<Class<?>>
a predicate which evaluates to true if a search should be performed on the enclosing class of the class supplied to the predicate
searchEnclosingClass
,
AnnotationsProcessor<C, R>
the processor that receives the annotations
processor
)

Scan the hierarchy of the specified element for relevant annotations and call the processor as required.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseTypeMethodsCacheback to summary
private static final Map<Class<?>, Method[]> baseTypeMethodsCache
declaredAnnotationCacheback to summary
private static final Map<AnnotatedElement, Annotation[]> declaredAnnotationCache
NO_ANNOTATIONSback to summary
private static final Annotation[] NO_ANNOTATIONS
NO_METHODSback to summary
private static final Method[] NO_METHODS

Constructor Detail

AnnotationsScannerback to summary
private AnnotationsScanner()

Method Detail

clearCacheback to summary
pack-priv static void clearCache()
getBaseTypeMethodsback to summary
private static <C> Method[] getBaseTypeMethods(C context, Class<?> baseType)
getDeclaredAnnotationback to summary
pack-priv static <A extends Annotation> A getDeclaredAnnotation(AnnotatedElement source, Class<A> annotationType)
Annotations
@SuppressWarnings:unchecked
@Nullable
getDeclaredAnnotationsback to summary
pack-priv static Annotation[] getDeclaredAnnotations(AnnotatedElement source, boolean defensive)
hasPlainJavaAnnotationsOnlyback to summary
pack-priv static boolean hasPlainJavaAnnotationsOnly(Object annotatedElement)
hasPlainJavaAnnotationsOnlyback to summary
pack-priv static boolean hasPlainJavaAnnotationsOnly(Class<?> type)
hasSameGenericTypeParametersback to summary
private static boolean hasSameGenericTypeParameters(Method rootMethod, Method candidateMethod, Class<?>[] rootParameterTypes)
hasSameParameterTypesback to summary
private static boolean hasSameParameterTypes(Method rootMethod, Method candidateMethod)
isIgnorableback to summary
private static boolean isIgnorable(Class<?> annotationType)
isKnownEmptyback to summary
pack-priv static boolean isKnownEmpty(AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass)
isOverrideback to summary
private static boolean isOverride(Method rootMethod, Method candidateMethod)
isWithoutHierarchyback to summary
private static boolean isWithoutHierarchy(AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass)
processback to summary
private static <C, R> R process(C context, AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processClassback to summary
private static <C, R> R processClass(C context, Class<?> source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processClassHierarchyback to summary
private static <C, R> R processClassHierarchy(C context, Class<?> source, AnnotationsProcessor<C, R> processor, boolean includeInterfaces, Predicate<Class<?>> searchEnclosingClass)
Annotations
@Nullable
processClassHierarchyback to summary
private static <C, R> R processClassHierarchy(C context, int[] aggregateIndex, Class<?> source, AnnotationsProcessor<C, R> processor, boolean includeInterfaces, Predicate<Class<?>> searchEnclosingClass)
Annotations
@Nullable
processClassInheritedAnnotationsback to summary
private static <C, R> R processClassInheritedAnnotations(C context, Class<?> source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processElementback to summary
private static <C, R> R processElement(C context, AnnotatedElement source, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processMethodback to summary
private static <C, R> R processMethod(C context, Method source, MergedAnnotations.SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processMethodAnnotationsback to summary
private static <C, R> R processMethodAnnotations(C context, int aggregateIndex, Method source, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
processMethodHierarchyback to summary
private static <C, R> R processMethodHierarchy(C context, int[] aggregateIndex, Class<?> sourceClass, AnnotationsProcessor<C, R> processor, Method rootMethod, boolean includeInterfaces)
Annotations
@Nullable
processMethodInheritedAnnotationsback to summary
private static <C, R> R processMethodInheritedAnnotations(C context, Method source, AnnotationsProcessor<C, R> processor)
Annotations
@Nullable
scanback to summary
pack-priv static <C, R> R scan(C context, AnnotatedElement source, MergedAnnotations.SearchStrategy searchStrategy, Predicate<Class<?>> searchEnclosingClass, AnnotationsProcessor<C, R> processor)

Scan the hierarchy of the specified element for relevant annotations and call the processor as required.

Parameters
context:C

an optional context object that will be passed back to the processor

source:AnnotatedElement

the source element to scan

searchStrategy:MergedAnnotations.SearchStrategy

the search strategy to use

searchEnclosingClass:Predicate<Class<?>>

a predicate which evaluates to true if a search should be performed on the enclosing class of the class supplied to the predicate

processor:AnnotationsProcessor<C, R>

the processor that receives the annotations

Returns:R

the result of AnnotationsProcessor#finish(Object)

Annotations
@Nullable