类 AnnotationPlusUtils


  • public abstract class AnnotationPlusUtils
    extends Object
    • 字段详细资料

      • ANNOTATED_ELEMENT_UTILS_CLASS_NAME

        public static final String ANNOTATED_ELEMENT_UTILS_CLASS_NAME
        The class name of AnnotatedElementUtils that is introduced since Spring Framework 4
        另请参阅:
        常量字段值
    • 构造器详细资料

      • AnnotationPlusUtils

        public AnnotationPlusUtils()
    • 方法详细资料

      • isPresent

        public static <A extends Annotation> boolean isPresent​(Method method,
                                                               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
      • getAttributes

        public static Map<String,​Object> getAttributes​(Annotation annotation,
                                                             boolean ignoreDefaultValue,
                                                             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
        从以下版本开始:
        1.0.2
      • getAttributes

        public static Map<String,​Object> getAttributes​(Annotation annotation,
                                                             org.springframework.core.env.PropertyResolver propertyResolver,
                                                             boolean ignoreDefaultValue,
                                                             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
        从以下版本开始:
        1.0.2
      • getAttributes

        public static Map<String,​Object> getAttributes​(Map<String,​Object> annotationAttributes,
                                                             org.springframework.core.env.PropertyResolver propertyResolver,
                                                             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
        从以下版本开始:
        1.0.4
      • getAttribute

        public static <T> T getAttribute​(Annotation annotation,
                                         String attributeName)
        Get the attribute value
        类型参数:
        T - the type of attribute value
        参数:
        annotation - annotation
        attributeName - the name of attribute
        返回:
        the attribute value if found
        从以下版本开始:
        1.0.3
      • getAttribute

        public static <T> T getAttribute​(Map<String,​Object> attributes,
                                         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
        从以下版本开始:
        1.0.3
      • getAttribute

        public static <T> T getAttribute​(Map<String,​Object> attributes,
                                         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
        抛出:
        IllegalStateException - if attribute value can't be found
        从以下版本开始:
        1.0.6
      • getAttribute

        public static <T> T getAttribute​(Map<String,​Object> attributes,
                                         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
        从以下版本开始:
        1.0.6
      • getRequiredAttribute

        public static <T> T getRequiredAttribute​(Map<String,​Object> attributes,
                                                 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
        抛出:
        IllegalStateException - if attribute value can't be found
        从以下版本开始:
        1.0.6
      • getAnnotationAttributes

        public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes​(Annotation annotation,
                                                                                                       boolean ignoreDefaultValue,
                                                                                                       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
        从以下版本开始:
        1.0.3
        另请参阅:
        getAnnotationAttributes(Annotation, PropertyResolver, boolean, String...)
      • getAnnotationAttributes

        public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes​(AnnotatedElement annotatedElement,
                                                                                                       Class<? extends Annotation> annotationType,
                                                                                                       org.springframework.core.env.PropertyResolver propertyResolver,
                                                                                                       boolean ignoreDefaultValue,
                                                                                                       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
        从以下版本开始:
        1.0.3
      • getAnnotationAttributes

        public 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
        参数:
        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
        从以下版本开始:
        1.0.3
      • getAnnotationMeta

        public static AnnotationMeta getAnnotationMeta​(AnnotatedElement annotatedElement,
                                                       Class<? extends Annotation> annotationType,
                                                       org.springframework.core.env.PropertyResolver propertyResolver,
                                                       boolean ignoreDefaultValue,
                                                       boolean tryMergedAnnotation,
                                                       String... ignoreAttributeNames)
      • tryGetMergedAnnotationAttributes

        public static org.springframework.core.annotation.AnnotationAttributes tryGetMergedAnnotationAttributes​(AnnotatedElement annotatedElement,
                                                                                                                Class<? extends Annotation> annotationType,
                                                                                                                org.springframework.core.env.PropertyResolver propertyResolver,
                                                                                                                boolean ignoreDefaultValue,
                                                                                                                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
        从以下版本开始:
        1.0.3