class MapAnnotationAttributeExtractor extends AbstractAliasAwareAnnotationAttributeExtractor<java.util.Map<java.lang.String,java.lang.Object>>
AnnotationAttributeExtractor
strategy that
is backed by a Map
.Annotation
,
AliasFor
,
AbstractAliasAwareAnnotationAttributeExtractor
,
DefaultAnnotationAttributeExtractor
,
AnnotationUtils.synthesizeAnnotation(Map, Class, AnnotatedElement)
Constructor and Description |
---|
MapAnnotationAttributeExtractor(java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.reflect.AnnotatedElement annotatedElement)
Construct a new
MapAnnotationAttributeExtractor . |
Modifier and Type | Method and Description |
---|---|
private static java.util.Map<java.lang.String,java.lang.Object> |
enrichAndValidateAttributes(java.util.Map<java.lang.String,java.lang.Object> originalAttributes,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Enrich and validate the supplied attributes map by ensuring
that it contains a non-null entry for each annotation attribute in
the specified
annotationType and that the type of the entry
matches the return type for the corresponding annotation attribute. |
protected java.lang.Object |
getRawAttributeValue(java.lang.reflect.Method attributeMethod)
Get the raw, unmodified attribute value from the underlying
source that corresponds to the supplied
attribute method.
|
protected java.lang.Object |
getRawAttributeValue(java.lang.String attributeName)
Get the raw, unmodified attribute value from the underlying
source that corresponds to the supplied
attribute name.
|
getAnnotatedElement, getAnnotationType, getAttributeValue, getSource
MapAnnotationAttributeExtractor(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.reflect.AnnotatedElement annotatedElement)
MapAnnotationAttributeExtractor
.
The supplied map must contain a key-value pair for every attribute
defined in the supplied annotationType
that is not aliased or
does not have a default value.
attributes
- the map of annotation attributes; never null
annotationType
- the type of annotation to synthesize; never null
annotatedElement
- the element that is annotated with the annotation
of the supplied type; may be null
if unknownprotected java.lang.Object getRawAttributeValue(java.lang.reflect.Method attributeMethod)
AbstractAliasAwareAnnotationAttributeExtractor
getRawAttributeValue
in class AbstractAliasAwareAnnotationAttributeExtractor<java.util.Map<java.lang.String,java.lang.Object>>
protected java.lang.Object getRawAttributeValue(java.lang.String attributeName)
AbstractAliasAwareAnnotationAttributeExtractor
getRawAttributeValue
in class AbstractAliasAwareAnnotationAttributeExtractor<java.util.Map<java.lang.String,java.lang.Object>>
private static java.util.Map<java.lang.String,java.lang.Object> enrichAndValidateAttributes(java.util.Map<java.lang.String,java.lang.Object> originalAttributes, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
and that the type of the entry
matches the return type for the corresponding annotation attribute.
If an entry is a map (presumably of annotation attributes), an attempt will be made to synthesize an annotation from it. Similarly, if an entry is an array of maps, an attempt will be made to synthesize an array of annotations from those maps.
If an attribute is missing in the supplied map, it will be set
either to the value of its alias (if an alias exists) or to the
value of the attribute's default value (if defined), and otherwise
an IllegalArgumentException
will be thrown.