public abstract class AnnotationUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ANNOTATED_ELEMENT_UTILS_CLASS_NAME
The class name of AnnotatedElementUtils that is introduced since Spring Framework 4
|
| Constructor and Description |
|---|
AnnotationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap,
boolean ignoreDefaultValue,
boolean tryMergedAnnotation,
String... ignoreAttributeNames)
Get the
AnnotationAttributes, if the argument tryMergedAnnotation is true,
the AnnotationAttributes will be got from
merged annotation first,
if failed, and then to get from
normal one |
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Get the
AnnotationAttributes |
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean ignoreDefaultValue,
boolean tryMergedAnnotation,
String... ignoreAttributeNames)
Get the
AnnotationAttributes, if the argument tryMergedAnnotation is true,
the AnnotationAttributes will be got from
merged annotation first,
if failed, and then to get from
normal one |
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(Annotation annotation,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Get the
AnnotationAttributes |
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(Annotation annotation,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Get the
AnnotationAttributes |
static org.springframework.core.annotation.AnnotationAttributes |
getAnnotationAttributes(Annotation annotation,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Get the
AnnotationAttributes |
static <T> T |
getAttribute(Map<String,Object> attributes,
String attributeName)
Get the attribute value
|
static <T> T |
getAttribute(Map<String,Object> attributes,
String attributeName,
boolean required)
Get the attribute value the will
|
static <T> T |
getAttribute(Map<String,Object> attributes,
String attributeName,
T defaultValue)
Get the attribute value with default value
|
static Map<String,Object> |
getAttributes(Annotation annotation,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap,
boolean ignoreDefaultValue,
String... ignoreAttributeNames) |
static Map<String,Object> |
getAttributes(Annotation annotation,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Get the
Annotation attributes |
static Map<String,Object> |
getAttributes(Map<String,Object> annotationAttributes,
org.springframework.core.env.PropertyResolver propertyResolver,
String... ignoreAttributeNames)
Get the
Annotation attributes |
static <T> T |
getRequiredAttribute(Map<String,Object> attributes,
String attributeName)
Get the required attribute value
|
static Annotation |
tryGetMergedAnnotation(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap)
Try to get the merged
annotation |
static org.springframework.core.annotation.AnnotationAttributes |
tryGetMergedAnnotationAttributes(AnnotatedElement annotatedElement,
Class<? extends Annotation> annotationType,
org.springframework.core.env.PropertyResolver propertyResolver,
boolean classValuesAsString,
boolean nestedAnnotationsAsMap,
boolean ignoreDefaultValue,
String... ignoreAttributeNames)
Try to get
the annotation attributes after merging and resolving the placeholders |
public static final String ANNOTATED_ELEMENT_UTILS_CLASS_NAME
public static Map<String,Object> getAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Annotation attributesannotation - specified AnnotationpropertyResolver - PropertyResolver instance, e.g EnvironmentignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignoredpublic static Map<String,Object> getAttributes(Map<String,Object> annotationAttributes, org.springframework.core.env.PropertyResolver propertyResolver, String... ignoreAttributeNames)
Annotation attributesannotationAttributes - the attributes of specified AnnotationpropertyResolver - PropertyResolver instance, e.g EnvironmentignoreAttributeNames - the attribute names of annotation should be ignoredpublic static Map<String,Object> getAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, String... ignoreAttributeNames)
annotation - specified AnnotationpropertyResolver - PropertyResolver instance, e.g EnvironmentclassValuesAsString - whether to turn Class references into Strings (for
compatibility with AnnotationMetadata or to
preserve them as Class referencesnestedAnnotationsAsMap - whether to turn nested Annotation instances into
AnnotationAttributes maps (for compatibility with
AnnotationMetadata or to preserve them as
Annotation instancesignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignoredpublic static <T> T getAttribute(Map<String,Object> attributes, String attributeName)
T - the type of attribute valueattributes - the annotation attributes or AnnotationAttributesattributeName - the name of attributepublic static <T> T getAttribute(Map<String,Object> attributes, String attributeName, boolean required)
T - the type of attribute valueattributes - the annotation attributes or AnnotationAttributesattributeName - the name of attributerequired - the required attribute or notIllegalStateException - if attribute value can't be foundpublic static <T> T getAttribute(Map<String,Object> attributes, String attributeName, T defaultValue)
T - the type of attribute valueattributes - the annotation attributes or AnnotationAttributesattributeName - the name of attributedefaultValue - the default value of attributepublic static <T> T getRequiredAttribute(Map<String,Object> attributes, String attributeName)
T - the type of attribute valueattributes - the annotation attributes or AnnotationAttributesattributeName - the name of attributeIllegalStateException - if attribute value can't be foundpublic static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(Annotation annotation, boolean ignoreDefaultValue, String... ignoreAttributeNames)
AnnotationAttributesannotation - specified AnnotationignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignoredgetAnnotationAttributes(Annotation, PropertyResolver, boolean, String...)public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, String... ignoreAttributeNames)
AnnotationAttributesannotation - specified AnnotationpropertyResolver - PropertyResolver instance, e.g EnvironmentclassValuesAsString - whether to turn Class references into Strings (for
compatibility with AnnotationMetadata or to
preserve them as Class referencesnestedAnnotationsAsMap - whether to turn nested Annotation instances into
AnnotationAttributes maps (for compatibility with
AnnotationMetadata or to preserve them as
Annotation instancesignoreAttributeNames - the attribute names of annotation should be ignoredignoreDefaultValue - whether ignore default value or notgetAttributes(Annotation, PropertyResolver, boolean, String...),
#getAnnotationAttributes(AnnotatedElement, Class, PropertyResolver, boolean, String...)public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
AnnotationAttributesannotation - specified AnnotationpropertyResolver - PropertyResolver instance, e.g EnvironmentignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignoredgetAttributes(Annotation, PropertyResolver, boolean, String...),
#getAnnotationAttributes(AnnotatedElement, Class, PropertyResolver, boolean, String...)public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, String... ignoreAttributeNames)
AnnotationAttributesannotatedElement - the annotated elementannotationType - the tyoe pf annotationpropertyResolver - PropertyResolver instance, e.g EnvironmentignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignoredannotatedElement can't be found in annotatedElement, return nullpublic static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)
AnnotationAttributes, if the argument tryMergedAnnotation is true,
the AnnotationAttributes will be got from
merged annotation first,
if failed, and then to get from
normal oneannotatedElement - the annotated elementannotationType - the tyoe pf annotationpropertyResolver - PropertyResolver instance, e.g EnvironmentignoreDefaultValue - whether ignore default value or nottryMergedAnnotation - whether try merged annotation or notignoreAttributeNames - the attribute names of annotation should be ignoredannotatedElement can't be found in annotatedElement, return nullpublic static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)
AnnotationAttributes, if the argument tryMergedAnnotation is true,
the AnnotationAttributes will be got from
merged annotation first,
if failed, and then to get from
normal oneannotatedElement - the annotated elementannotationType - the tyoe pf annotationpropertyResolver - PropertyResolver instance, e.g EnvironmentclassValuesAsString - whether to turn Class references into Strings (for
compatibility with AnnotationMetadata or to
preserve them as Class referencesnestedAnnotationsAsMap - whether to turn nested Annotation instances into
AnnotationAttributes maps (for compatibility with
AnnotationMetadata or to preserve them as
Annotation instancesignoreDefaultValue - whether ignore default value or nottryMergedAnnotation - whether try merged annotation or notignoreAttributeNames - the attribute names of annotation should be ignoredannotatedElement can't be found in annotatedElement, return nullpublic static Annotation tryGetMergedAnnotation(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
annotationannotatedElement - the annotated elementannotationType - the tyoe pf annotationclassValuesAsString - whether to turn Class references into Strings (for
compatibility with AnnotationMetadata or to
preserve them as Class referencesnestedAnnotationsAsMap - whether to turn nested Annotation instances into
AnnotationAttributes maps (for compatibility with
AnnotationMetadata or to preserve them as
Annotation instancesnullpublic static org.springframework.core.annotation.AnnotationAttributes tryGetMergedAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, String... ignoreAttributeNames)
the annotation attributes after merging and resolving the placeholdersannotatedElement - the annotated elementannotationType - the tyoe pf annotationpropertyResolver - PropertyResolver instance, e.g EnvironmentclassValuesAsString - whether to turn Class references into Strings (for
compatibility with AnnotationMetadata or to
preserve them as Class referencesnestedAnnotationsAsMap - whether to turn nested Annotation instances into
AnnotationAttributes maps (for compatibility with
AnnotationMetadata or to preserve them as
Annotation instancesignoreDefaultValue - whether ignore default value or notignoreAttributeNames - the attribute names of annotation should be ignorednullCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.