private static class AnnotatedElementUtils.MergedAnnotationAttributesProcessor extends java.lang.Object implements AnnotatedElementUtils.Processor<AnnotationAttributes>
AnnotatedElementUtils.Processor
that gets the AnnotationAttributes
for the
target annotation during the process(java.lang.reflect.AnnotatedElement, java.lang.annotation.Annotation, int)
phase and then merges
annotation attributes from lower levels in the annotation hierarchy
during the postProcess(java.lang.reflect.AnnotatedElement, java.lang.annotation.Annotation, org.springframework.core.annotation.AnnotationAttributes)
phase.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
annotationName |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
annotationType |
private boolean |
classValuesAsString |
private boolean |
nestedAnnotationsAsMap |
Constructor and Description |
---|
MergedAnnotationAttributesProcessor(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.String annotationName,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap) |
Modifier and Type | Method and Description |
---|---|
private void |
overrideAttribute(java.lang.reflect.AnnotatedElement element,
java.lang.annotation.Annotation annotation,
AnnotationAttributes attributes,
java.lang.String sourceAttributeName,
java.lang.String targetAttributeName) |
void |
postProcess(java.lang.reflect.AnnotatedElement element,
java.lang.annotation.Annotation annotation,
AnnotationAttributes attributes)
Post-process the result returned by the
AnnotatedElementUtils.Processor.process(java.lang.reflect.AnnotatedElement, java.lang.annotation.Annotation, int) method. |
AnnotationAttributes |
process(java.lang.reflect.AnnotatedElement annotatedElement,
java.lang.annotation.Annotation annotation,
int metaDepth)
Process the supplied annotation.
|
private final java.lang.Class<? extends java.lang.annotation.Annotation> annotationType
private final java.lang.String annotationName
private final boolean classValuesAsString
private final boolean nestedAnnotationsAsMap
MergedAnnotationAttributesProcessor(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.String annotationName, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
public AnnotationAttributes process(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.annotation.Annotation annotation, int metaDepth)
AnnotatedElementUtils.Processor
Depending on the use case, the supplied annotation may be an
actual target annotation that has been found by the search
algorithm, or it may be some other annotation within the
annotation hierarchy. In the latter case, the metaDepth
should have a value greater than 0
. In any case, it is
up to concrete implementations of this method to decide what to
do with the supplied annotation.
The metaDepth
parameter represents the depth of the
annotation relative to the first annotated element in the
annotation hierarchy. For example, an annotation that is
present on a non-annotation element will have a depth
of 0; a meta-annotation will have a depth of 1; and a
meta-meta-annotation will have a depth of 2; etc.
process
in interface AnnotatedElementUtils.Processor<AnnotationAttributes>
annotatedElement
- the element that is annotated with the
supplied annotation, used for contextual logging; may be
null
if unknownannotation
- the annotation to processmetaDepth
- the meta-depth of the annotationnull
to continue
searching for additional annotationspublic void postProcess(java.lang.reflect.AnnotatedElement element, java.lang.annotation.Annotation annotation, AnnotationAttributes attributes)
AnnotatedElementUtils.Processor
AnnotatedElementUtils.Processor.process(java.lang.reflect.AnnotatedElement, java.lang.annotation.Annotation, int)
method.
The annotation
supplied to this method is an annotation
that is present in the annotation hierarchy, between the initial
AnnotatedElement
and an invocation of AnnotatedElementUtils.Processor.process(java.lang.reflect.AnnotatedElement, java.lang.annotation.Annotation, int)
that returned a non-null value.
postProcess
in interface AnnotatedElementUtils.Processor<AnnotationAttributes>
element
- the element that is annotated with the
supplied annotation, used for contextual logging; may be
null
if unknownannotation
- the annotation to post-processattributes
- the result to post-processprivate void overrideAttribute(java.lang.reflect.AnnotatedElement element, java.lang.annotation.Annotation annotation, AnnotationAttributes attributes, java.lang.String sourceAttributeName, java.lang.String targetAttributeName)