Package io.microsphere.spring.util
Class AnnotationUtils
- java.lang.Object
-
- io.microsphere.spring.util.AnnotationUtils
-
public abstract class AnnotationUtils extends java.lang.Object
Annotation
Utilities- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
Annotation
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Class<?>
ANNOTATED_ELEMENT_UTILS_CLASS
TheClass
ofAnnotatedElementUtils
that is introduced since Spring Framework 4static java.lang.String
ANNOTATED_ELEMENT_UTILS_CLASS_NAME
The class name ofthat is introduced since Spring Framework 4
static java.lang.reflect.Method
ANNOTATION_ATTRIBUTES_ANNOTATION_TYPE_METHOD
TheMethod
object ofAnnotationAttributes.annotationType()
is introduced since Spring Framework 4.2
-
Constructor Summary
Constructors Constructor Description AnnotationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A extends java.lang.annotation.Annotation>
java.util.Map<java.lang.annotation.ElementType,java.util.List<A>>findAnnotations(java.lang.reflect.Method method, java.lang.Class<A> annotationClass)
Find specifiedAnnotation
type maps fromMethod
static <A extends java.lang.annotation.Annotation>
java.lang.Class<A>findAnnotationType(org.springframework.core.annotation.AnnotationAttributes annotationAttributes)
Find theclass
ofAnnotation
from the specifiedAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, boolean tryMergedAnnotation, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
, if the argumenttryMergedAnnotation
istrue
, theAnnotationAttributes
will be got frommerged annotation
first, if failed, and then to get fromnormal one
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
, if the argumenttryMergedAnnotation
istrue
, theAnnotationAttributes
will be got frommerged annotation
first, if failed, and then to get fromnormal one
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(org.springframework.core.type.AnnotationMetadata metadata, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Get an instance ofAnnotationAttributes
fromAnnotationMetadata
with the specified class name ofannotation
.static org.springframework.core.annotation.AnnotationAttributes
getAnnotationAttributes(org.springframework.core.type.AnnotationMetadata metadata, java.lang.String annotationClassName)
Get an instance ofAnnotationAttributes
fromAnnotationMetadata
with the specified class name ofannotation
.static <T> T
getAttribute(java.lang.annotation.Annotation annotation, java.lang.String attributeName)
Get the attribute valuestatic <T> T
getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName)
Get the attribute valuestatic <T> T
getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName, boolean required)
Get the attribute value the willstatic <T> T
getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName, T defaultValue)
Get the attribute value with default valuestatic java.util.Map<java.lang.String,java.lang.Object>
getAttributes(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributesstatic java.util.Map<java.lang.String,java.lang.Object>
getAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
static java.util.Map<java.lang.String,java.lang.Object>
getAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributesstatic java.util.Map<java.lang.String,java.lang.Object>
getAttributes(java.util.Map<java.lang.String,java.lang.Object> annotationAttributes, org.springframework.core.env.PropertyResolver propertyResolver, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributesstatic <T> T
getRequiredAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName)
Get the required attribute valuestatic <A extends java.lang.annotation.Annotation>
booleanisPresent(java.lang.reflect.Method method, java.lang.Class<A> annotationClass)
Is specifiedAnnotation
present onMethod
's declaring class or parameters or itself.static java.lang.annotation.Annotation
tryGetMergedAnnotation(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Try to get the mergedannotation
static java.lang.annotation.Annotation
tryGetMergedAnnotation(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
Try to get the mergedannotation
static org.springframework.core.annotation.AnnotationAttributes
tryGetMergedAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Try to getthe annotation attributes
after merging and resolving the placeholdersstatic org.springframework.core.annotation.AnnotationAttributes
tryGetMergedAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Try to getthe annotation attributes
after merging and resolving the placeholders
-
-
-
Field Detail
-
ANNOTATED_ELEMENT_UTILS_CLASS_NAME
public static final java.lang.String ANNOTATED_ELEMENT_UTILS_CLASS_NAME
The class name ofthat is introduced since Spring Framework 4
- See Also:
- Constant Field Values
-
ANNOTATED_ELEMENT_UTILS_CLASS
public static final java.lang.Class<?> ANNOTATED_ELEMENT_UTILS_CLASS
TheClass
ofAnnotatedElementUtils
that is introduced since Spring Framework 4
-
ANNOTATION_ATTRIBUTES_ANNOTATION_TYPE_METHOD
public static final java.lang.reflect.Method ANNOTATION_ATTRIBUTES_ANNOTATION_TYPE_METHOD
TheMethod
object ofAnnotationAttributes.annotationType()
is introduced since Spring Framework 4.2
-
-
Method Detail
-
isPresent
public static <A extends java.lang.annotation.Annotation> boolean isPresent(java.lang.reflect.Method method, java.lang.Class<A> annotationClass)
Is specifiedAnnotation
present onMethod
's declaring class or parameters or itself.- Type Parameters:
A
-Annotation
type- Parameters:
method
-Method
annotationClass
-Annotation
type- Returns:
- If present , return
true
, orfalse
-
findAnnotations
public static <A extends java.lang.annotation.Annotation> java.util.Map<java.lang.annotation.ElementType,java.util.List<A>> findAnnotations(java.lang.reflect.Method method, java.lang.Class<A> annotationClass)
Find specifiedAnnotation
type maps fromMethod
- Type Parameters:
A
-Annotation
type- Parameters:
method
-Method
annotationClass
-Annotation
type- Returns:
Annotation
type maps , theElementType
as key , the list ofAnnotation
as value. IfAnnotation
was annotated onMethod
's parametersElementType.PARAMETER
, the associatedAnnotation
list may contain multiple elements.
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.Object> getAttributes(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributes- Parameters:
annotation
- specifiedAnnotation
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- non-null
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.Object> getAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributes- Parameters:
annotation
- specifiedAnnotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- non-null
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.Object> getAttributes(java.util.Map<java.lang.String,java.lang.Object> annotationAttributes, org.springframework.core.env.PropertyResolver propertyResolver, java.lang.String... ignoreAttributeNames)
Get theAnnotation
attributes- Parameters:
annotationAttributes
- the attributes of specifiedAnnotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- non-null
-
getAttributes
public static java.util.Map<java.lang.String,java.lang.Object> getAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
- Parameters:
annotation
- specifiedAnnotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
classValuesAsString
- whether to turn Class references into Strings (for compatibility withAnnotationMetadata
or to preserve them as Class referencesnestedAnnotationsAsMap
- whether to turn nested Annotation instances intoAnnotationAttributes
maps (for compatibility withAnnotationMetadata
or to preserve them as Annotation instancesignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
-
getAttribute
public static <T> T getAttribute(java.lang.annotation.Annotation annotation, java.lang.String attributeName)
Get the attribute value- Type Parameters:
T
- the type of attribute value- Parameters:
annotation
-annotation
attributeName
- the name of attribute- Returns:
- the attribute value if found
-
getAttribute
public static <T> T getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName)
Get the attribute value- Type Parameters:
T
- the type of attribute value- Parameters:
attributes
-the annotation attributes
orAnnotationAttributes
attributeName
- the name of attribute- Returns:
- the attribute value if found
-
getAttribute
public static <T> T getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName, boolean required)
Get the attribute value the will- Type Parameters:
T
- the type of attribute value- Parameters:
attributes
-the annotation attributes
orAnnotationAttributes
attributeName
- the name of attributerequired
- the required attribute or not- Returns:
- the attribute value if found
- Throws:
java.lang.IllegalStateException
- if attribute value can't be found
-
getAttribute
public static <T> T getAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName, T defaultValue)
Get the attribute value with default value- Type Parameters:
T
- the type of attribute value- Parameters:
attributes
-the annotation attributes
orAnnotationAttributes
attributeName
- the name of attributedefaultValue
- the default value of attribute- Returns:
- the attribute value if found
-
getRequiredAttribute
public static <T> T getRequiredAttribute(java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String attributeName)
Get the required attribute value- Type Parameters:
T
- the type of attribute value- Parameters:
attributes
-the annotation attributes
orAnnotationAttributes
attributeName
- the name of attribute- Returns:
- the attribute value if found
- Throws:
java.lang.IllegalStateException
- if attribute value can't be found
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
- Parameters:
annotation
- specifiedAnnotation
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- non-null
- See Also:
getAnnotationAttributes(Annotation, PropertyResolver, boolean, String...)
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
- Parameters:
annotation
- specifiedAnnotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
classValuesAsString
- whether to turn Class references into Strings (for compatibility withAnnotationMetadata
or to preserve them as Class referencesnestedAnnotationsAsMap
- whether to turn nested Annotation instances intoAnnotationAttributes
maps (for compatibility withAnnotationMetadata
or to preserve them as Annotation instancesignoreAttributeNames
- the attribute names of annotation should be ignoredignoreDefaultValue
- whether ignore default value or not- Returns:
- non-null
- See Also:
getAttributes(Annotation, PropertyResolver, boolean, String...)
,getAnnotationAttributes(AnnotatedElement, Class, PropertyResolver, boolean, String...)
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.annotation.Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
- Parameters:
annotation
- specifiedAnnotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- non-null
- See Also:
getAttributes(Annotation, PropertyResolver, boolean, String...)
,getAnnotationAttributes(AnnotatedElement, Class, PropertyResolver, boolean, String...)
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- if
annotatedElement
can't be found inannotatedElement
, returnnull
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- if
annotatedElement
can't be found inannotatedElement
, returnnull
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
, if the argumenttryMergedAnnotation
istrue
, theAnnotationAttributes
will be got frommerged annotation
first, if failed, and then to get fromnormal one
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or nottryMergedAnnotation
- whether try merged annotation or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- if
annotatedElement
can't be found inannotatedElement
, returnnull
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, boolean tryMergedAnnotation, java.lang.String... ignoreAttributeNames)
Get theAnnotationAttributes
, if the argumenttryMergedAnnotation
istrue
, theAnnotationAttributes
will be got frommerged annotation
first, if failed, and then to get fromnormal one
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
classValuesAsString
- whether to turn Class references into Strings (for compatibility withAnnotationMetadata
or to preserve them as Class referencesnestedAnnotationsAsMap
- whether to turn nested Annotation instances intoAnnotationAttributes
maps (for compatibility withAnnotationMetadata
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 ignored- Returns:
- if
annotatedElement
can't be found inannotatedElement
, returnnull
-
tryGetMergedAnnotation
public static java.lang.annotation.Annotation tryGetMergedAnnotation(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Try to get the mergedannotation
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
- Returns:
- If current version of Spring Framework is below 4.2, return
null
-
tryGetMergedAnnotation
public static java.lang.annotation.Annotation tryGetMergedAnnotation(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
Try to get the mergedannotation
- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
classValuesAsString
- whether to turn Class references into Strings (for compatibility withAnnotationMetadata
or to preserve them as Class referencesnestedAnnotationsAsMap
- whether to turn nested Annotation instances intoAnnotationAttributes
maps (for compatibility withAnnotationMetadata
or to preserve them as Annotation instances- Returns:
- If current version of Spring Framework is below 4.2, return
null
-
tryGetMergedAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes tryGetMergedAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Try to getthe annotation attributes
after merging and resolving the placeholders- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
ignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- If the specified annotation type is not found, return
null
-
tryGetMergedAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes tryGetMergedAnnotationAttributes(java.lang.reflect.AnnotatedElement annotatedElement, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean classValuesAsString, boolean nestedAnnotationsAsMap, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
Try to getthe annotation attributes
after merging and resolving the placeholders- Parameters:
annotatedElement
-the annotated element
annotationType
- thetyoe
pfannotation
propertyResolver
-PropertyResolver
instance, e.gEnvironment
classValuesAsString
- whether to turn Class references into Strings (for compatibility withAnnotationMetadata
or to preserve them as Class referencesnestedAnnotationsAsMap
- whether to turn nested Annotation instances intoAnnotationAttributes
maps (for compatibility withAnnotationMetadata
or to preserve them as Annotation instancesignoreDefaultValue
- whether ignore default value or notignoreAttributeNames
- the attribute names of annotation should be ignored- Returns:
- If the specified annotation type is not found, return
null
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(org.springframework.core.type.AnnotationMetadata metadata, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Get an instance ofAnnotationAttributes
fromAnnotationMetadata
with the specified class name ofannotation
.- Parameters:
metadata
-AnnotationMetadata
annotationType
- Theclass
ofannotation
- Returns:
- non-null
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(org.springframework.core.type.AnnotationMetadata metadata, java.lang.String annotationClassName)
Get an instance ofAnnotationAttributes
fromAnnotationMetadata
with the specified class name ofannotation
.- Parameters:
metadata
-AnnotationMetadata
annotationClassName
- The class name ofannotation
- Returns:
- non-null
-
findAnnotationType
@Nullable public static <A extends java.lang.annotation.Annotation> java.lang.Class<A> findAnnotationType(org.springframework.core.annotation.AnnotationAttributes annotationAttributes)
Find theclass
ofAnnotation
from the specifiedAnnotationAttributes
- Type Parameters:
A
- Theclass
ofAnnotation
- Parameters:
annotationAttributes
-AnnotationAttributes
- Returns:
null
if not found
-
-