public abstract class AnnotationUtils extends Object
| Constructor and Description |
|---|
AnnotationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Annotation> |
createAnnotation(Class<T> annotationType,
Map<String,Object> attributes)
Creates instance (proxy) of the specified annotation with the given
attributes.
|
static Class<?> |
getAttributeType(Class<? extends Annotation> annotationType,
String attributeName)
Returns type of the specified attribute in the annotation type.
|
static boolean |
hasAttribute(Class<? extends Annotation> annotationType,
String attributeName)
Whether the annotation type contains attribute of the specified name.
|
static Map<String,Object> |
readAllAttributes(Annotation annotation)
Returns annotation's attributes (name and value) as map.
|
static <T> T |
readAttribute(Annotation annotation,
String name,
Class<T> requiredType) |
public static <T> T readAttribute(Annotation annotation, String name, Class<T> requiredType) throws IllegalArgumentException, IllegalStateException
public static boolean hasAttribute(Class<? extends Annotation> annotationType, String attributeName)
public static Class<?> getAttributeType(Class<? extends Annotation> annotationType, String attributeName)
public static Map<String,Object> readAllAttributes(Annotation annotation)
public static <T extends Annotation> T createAnnotation(Class<T> annotationType, Map<String,Object> attributes)
T - The type of the annotation.annotationType - The annotation's class.attributes - A map with attribute values for the annotation to be created.IllegalArgumentException - if some attribute has wrong type or
a required attribute is missing.Copyright © 2013–2017. All rights reserved.