类 AnnotationAttributes

    • 方法详细资料

      • annotationType

        @Nullable
        public Class<? extends AnnotationannotationType()
        Get the type of annotation represented by this AnnotationAttributes.
        返回:
        the annotation type, or null if unknown
        从以下版本开始:
        4.2
      • getString

        public String getString​(String attributeName)
        Get the value stored under the specified attributeName as a string.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getStringArray

        public String[] getStringArray​(String attributeName)
        Get the value stored under the specified attributeName as an array of strings.

        If the value stored under the specified attributeName is a string, it will be wrapped in a single-element array before returning it.

        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getBoolean

        public boolean getBoolean​(String attributeName)
        Get the value stored under the specified attributeName as a boolean.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getNumber

        public <N extends Number> N getNumber​(String attributeName)
        Get the value stored under the specified attributeName as a number.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getEnum

        public <E extends Enum<?>> E getEnum​(String attributeName)
        Get the value stored under the specified attributeName as an enum.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getClass

        public <T> Class<? extends T> getClass​(String attributeName)
        Get the value stored under the specified attributeName as a class.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getClassArray

        public Class<?>[] getClassArray​(String attributeName)
        Get the value stored under the specified attributeName as an array of classes.

        If the value stored under the specified attributeName is a class, it will be wrapped in a single-element array before returning it.

        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the value
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getAnnotation

        public <A extends Annotation> A getAnnotation​(String attributeName,
                                                      Class<A> annotationType)
        Get the annotation of type annotationType stored under the specified attributeName.
        参数:
        attributeName - the name of the attribute to get; never null or empty
        annotationType - the expected annotation type; never null
        返回:
        the annotation
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
        从以下版本开始:
        4.2
      • getAnnotationArray

        public AnnotationAttributes[] getAnnotationArray​(String attributeName)
        Get the array of AnnotationAttributes stored under the specified attributeName.

        If the value stored under the specified attributeName is an instance of AnnotationAttributes, it will be wrapped in a single-element array before returning it.

        Note: if you expect an actual array of annotations, invoke getAnnotationArray(String, Class) instead.

        参数:
        attributeName - the name of the attribute to get; never null or empty
        返回:
        the array of AnnotationAttributes
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
      • getAnnotationArray

        public <A extends Annotation> A[] getAnnotationArray​(String attributeName,
                                                             Class<A> annotationType)
        Get the array of type annotationType stored under the specified attributeName.

        If the value stored under the specified attributeName is an Annotation, it will be wrapped in a single-element array before returning it.

        参数:
        attributeName - the name of the attribute to get; never null or empty
        annotationType - the expected annotation type; never null
        返回:
        the annotation array
        抛出:
        IllegalArgumentException - if the attribute does not exist or if it is not of the expected type
        从以下版本开始:
        4.2