class MapAnnotationAttributeExtractor extends AbstractAliasAwareAnnotationAttributeExtractor
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> attributes,
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. |
private java.util.Map<java.lang.String,java.lang.Object> |
getMap() |
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
protected java.lang.Object getRawAttributeValue(java.lang.String attributeName)
AbstractAliasAwareAnnotationAttributeExtractor
getRawAttributeValue
in class AbstractAliasAwareAnnotationAttributeExtractor
private java.util.Map<java.lang.String,java.lang.Object> getMap()
private static java.util.Map<java.lang.String,java.lang.Object> enrichAndValidateAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
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.
If an attribute is missing in the supplied map, it will be set
either to value of its alias (if an alias value exists) or to the
value of the attribute's default value (if defined), and otherwise
an IllegalArgumentException
will be thrown.
AliasFor