类 AnnotationUtils


  • public abstract class AnnotationUtils
    extends java.lang.Object
    Annotation Utilities
    从以下版本开始:
    1.0.0
    作者:
    Mercy
    另请参阅:
    Annotation
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      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 specified Annotation type maps from Method
      static <A extends java.lang.annotation.Annotation>
      java.lang.Class<A>
      findAnnotationType​(org.springframework.core.annotation.AnnotationAttributes annotationAttributes)
      Find the class of Annotation from the specified AnnotationAttributes
      static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes​(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
      Get the AnnotationAttributes
      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 the AnnotationAttributes
      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 the AnnotationAttributes
      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 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​(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 the AnnotationAttributes
      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 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​(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 the AnnotationAttributes
      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 of AnnotationAttributes from AnnotationMetadata with the specified class name of annotation.
      static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes​(org.springframework.core.type.AnnotationMetadata metadata, java.lang.String annotationClassName)
      Get an instance of AnnotationAttributes from AnnotationMetadata with the specified class name of annotation.
      static <T> T getAttribute​(java.lang.annotation.Annotation annotation, java.lang.String attributeName)
      Get the attribute value
      static <T> T getAttribute​(java.util.Map<java.lang.String,​java.lang.Object> attributes, java.lang.String attributeName)
      Get the attribute value
      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
      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
      static java.util.Map<java.lang.String,​java.lang.Object> getAttributes​(java.lang.annotation.Annotation annotation, boolean ignoreDefaultValue, java.lang.String... ignoreAttributeNames)
      Get the Annotation attributes
      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)  
      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 the Annotation attributes
      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 the Annotation attributes
      static <T> T getRequiredAttribute​(java.util.Map<java.lang.String,​java.lang.Object> attributes, java.lang.String attributeName)
      Get the required attribute value
      static <A extends java.lang.annotation.Annotation>
      boolean
      isPresent​(java.lang.reflect.Method method, java.lang.Class<A> annotationClass)
      Is specified Annotation present on Method'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 merged annotation
      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 merged annotation
      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 get the annotation attributes after merging and resolving the placeholders
      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 get the annotation attributes after merging and resolving the placeholders
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • ANNOTATED_ELEMENT_UTILS_CLASS_NAME

        public static final java.lang.String ANNOTATED_ELEMENT_UTILS_CLASS_NAME
        The class name of that is introduced since Spring Framework 4
        另请参阅:
        常量字段值
      • ANNOTATED_ELEMENT_UTILS_CLASS

        public static final java.lang.Class<?> ANNOTATED_ELEMENT_UTILS_CLASS
        The Class of AnnotatedElementUtils that is introduced since Spring Framework 4
      • ANNOTATION_ATTRIBUTES_ANNOTATION_TYPE_METHOD

        public static final java.lang.reflect.Method ANNOTATION_ATTRIBUTES_ANNOTATION_TYPE_METHOD
        The Method object of AnnotationAttributes.annotationType() is introduced since Spring Framework 4.2
    • 构造器详细资料

      • AnnotationUtils

        public AnnotationUtils()
    • 方法详细资料

      • isPresent

        public static <A extends java.lang.annotation.Annotation> boolean isPresent​(java.lang.reflect.Method method,
                                                                                    java.lang.Class<A> annotationClass)
        Is specified Annotation present on Method's declaring class or parameters or itself.
        类型参数:
        A - Annotation type
        参数:
        method - Method
        annotationClass - Annotation type
        返回:
        If present , return true , or false
      • 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 specified Annotation type maps from Method
        类型参数:
        A - Annotation type
        参数:
        method - Method
        annotationClass - Annotation type
        返回:
        Annotation type maps , the ElementType as key , the list of Annotation as value. If Annotation was annotated on Method's parametersElementType.PARAMETER , the associated Annotation 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 the Annotation attributes
        参数:
        annotation - specified Annotation
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        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 the Annotation attributes
        参数:
        annotation - specified Annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        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 the Annotation attributes
        参数:
        annotationAttributes - the attributes of specified Annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        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)
        参数:
        annotation - specified Annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        classValuesAsString - whether to turn Class references into Strings (for compatibility with AnnotationMetadata or to preserve them as Class references
        nestedAnnotationsAsMap - whether to turn nested Annotation instances into AnnotationAttributes maps (for compatibility with AnnotationMetadata or to preserve them as Annotation instances
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
      • getAttribute

        public static <T> T getAttribute​(java.lang.annotation.Annotation annotation,
                                         java.lang.String attributeName)
        Get the attribute value
        类型参数:
        T - the type of attribute value
        参数:
        annotation - annotation
        attributeName - the name of attribute
        返回:
        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
        类型参数:
        T - the type of attribute value
        参数:
        attributes - the annotation attributes or AnnotationAttributes
        attributeName - the name of attribute
        返回:
        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
        类型参数:
        T - the type of attribute value
        参数:
        attributes - the annotation attributes or AnnotationAttributes
        attributeName - the name of attribute
        required - the required attribute or not
        返回:
        the attribute value if found
        抛出:
        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
        类型参数:
        T - the type of attribute value
        参数:
        attributes - the annotation attributes or AnnotationAttributes
        attributeName - the name of attribute
        defaultValue - the default value of attribute
        返回:
        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
        类型参数:
        T - the type of attribute value
        参数:
        attributes - the annotation attributes or AnnotationAttributes
        attributeName - the name of attribute
        返回:
        the attribute value if found
        抛出:
        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 the AnnotationAttributes
        参数:
        annotation - specified Annotation
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        non-null
        另请参阅:
        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 the AnnotationAttributes
        参数:
        annotation - specified Annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        classValuesAsString - whether to turn Class references into Strings (for compatibility with AnnotationMetadata or to preserve them as Class references
        nestedAnnotationsAsMap - whether to turn nested Annotation instances into AnnotationAttributes maps (for compatibility with AnnotationMetadata or to preserve them as Annotation instances
        ignoreAttributeNames - the attribute names of annotation should be ignored
        ignoreDefaultValue - whether ignore default value or not
        返回:
        non-null
        另请参阅:
        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 the AnnotationAttributes
        参数:
        annotation - specified Annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        non-null
        另请参阅:
        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 the AnnotationAttributes
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        if annotatedElement can't be found in annotatedElement, return null
      • 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 the AnnotationAttributes
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        if annotatedElement can't be found in annotatedElement, return null
      • 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 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
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        tryMergedAnnotation - whether try merged annotation or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        if annotatedElement can't be found in annotatedElement, return null
      • 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 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
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        classValuesAsString - whether to turn Class references into Strings (for compatibility with AnnotationMetadata or to preserve them as Class references
        nestedAnnotationsAsMap - whether to turn nested Annotation instances into AnnotationAttributes maps (for compatibility with AnnotationMetadata or to preserve them as Annotation instances
        ignoreDefaultValue - whether ignore default value or not
        tryMergedAnnotation - whether try merged annotation or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        if annotatedElement can't be found in annotatedElement, return null
      • 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 merged annotation
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        返回:
        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 merged annotation
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        classValuesAsString - whether to turn Class references into Strings (for compatibility with AnnotationMetadata or to preserve them as Class references
        nestedAnnotationsAsMap - whether to turn nested Annotation instances into AnnotationAttributes maps (for compatibility with AnnotationMetadata or to preserve them as Annotation instances
        返回:
        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 get the annotation attributes after merging and resolving the placeholders
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        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 get the annotation attributes after merging and resolving the placeholders
        参数:
        annotatedElement - the annotated element
        annotationType - the tyoe pf annotation
        propertyResolver - PropertyResolver instance, e.g Environment
        classValuesAsString - whether to turn Class references into Strings (for compatibility with AnnotationMetadata or to preserve them as Class references
        nestedAnnotationsAsMap - whether to turn nested Annotation instances into AnnotationAttributes maps (for compatibility with AnnotationMetadata or to preserve them as Annotation instances
        ignoreDefaultValue - whether ignore default value or not
        ignoreAttributeNames - the attribute names of annotation should be ignored
        返回:
        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 of AnnotationAttributes from AnnotationMetadata with the specified class name of annotation.
        参数:
        metadata - AnnotationMetadata
        annotationType - The class of annotation
        返回:
        non-null
      • getAnnotationAttributes

        public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes​(org.springframework.core.type.AnnotationMetadata metadata,
                                                                                                       java.lang.String annotationClassName)
        Get an instance of AnnotationAttributes from AnnotationMetadata with the specified class name of annotation.
        参数:
        metadata - AnnotationMetadata
        annotationClassName - The class name of annotation
        返回:
        non-null
      • findAnnotationType

        @Nullable
        public static <A extends java.lang.annotation.Annotation> java.lang.Class<A> findAnnotationType​(org.springframework.core.annotation.AnnotationAttributes annotationAttributes)
        Find the class of Annotation from the specified AnnotationAttributes
        类型参数:
        A - The class of Annotation
        参数:
        annotationAttributes - AnnotationAttributes
        返回:
        null if not found