org.springframework.core.annotation
Class AnnotationAttributes
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,Object>
org.springframework.core.annotation.AnnotationAttributes
- All Implemented Interfaces:
- Serializable, Cloneable, Map<String,Object>
public class AnnotationAttributes
- extends LinkedHashMap<String,Object>
LinkedHashMap
subclass representing annotation attribute key/value pairs
as read by Spring's reflection- or ASM-based AnnotationMetadata
implementations.
Provides 'pseudo-reification' to avoid noisy Map generics in the calling code as well
as convenience methods for looking up annotation attributes in a type-safe fashion.
- Since:
- 3.1.1
- Author:
- Chris Beams
- See Also:
- Serialized Form
Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
AnnotationAttributes
public AnnotationAttributes()
- Create a new, empty
AnnotationAttributes
instance.
AnnotationAttributes
public AnnotationAttributes(int initialCapacity)
- Create a new, empty
AnnotationAttributes
instance with the given initial
capacity to optimize performance.
- Parameters:
initialCapacity
- initial size of the underlying map
AnnotationAttributes
public AnnotationAttributes(Map<String,Object> map)
- Create a new
AnnotationAttributes
instance, wrapping the provided map
and all its key/value pairs.
- Parameters:
map
- original source of annotation attribute key/value pairs to wrap- See Also:
fromMap(Map)
fromMap
public static AnnotationAttributes fromMap(Map<String,Object> map)
- Return an
AnnotationAttributes
instance based on the given map; if the map
is already an AnnotationAttributes
instance, it is casted and returned
immediately without creating any new instance; otherwise create a new instance by
wrapping the map with the AnnotationAttributes(Map)
constructor.
- Parameters:
map
- original source of annotation attribute key/value pairs
getString
public String getString(String attributeName)
getStringArray
public String[] getStringArray(String attributeName)
getBoolean
public boolean getBoolean(String attributeName)
getNumber
public <N extends Number> N getNumber(String attributeName)
getEnum
public <E extends Enum<?>> E getEnum(String attributeName)
getClass
public <T> Class<? extends T> getClass(String attributeName)
getClassArray
public Class<?>[] getClassArray(String attributeName)
getAnnotation
public AnnotationAttributes getAnnotation(String attributeName)
getAnnotationArray
public AnnotationAttributes[] getAnnotationArray(String attributeName)