类 AbstractMergedAnnotation<A extends Annotation>

java.lang.Object
cn.taketoday.core.annotation.AbstractMergedAnnotation<A>
类型参数:
A - the annotation type
所有已实现的接口:
MergedAnnotation<A>
直接已知子类:
MissingMergedAnnotation, TypeMappedAnnotation

abstract class AbstractMergedAnnotation<A extends Annotation> extends Object implements MergedAnnotation<A>
Abstract base class for MergedAnnotation implementations.
从以下版本开始:
4.0
作者:
Phillip Webb, Juergen Hoeller
  • 字段详细资料

  • 构造器详细资料

    • AbstractMergedAnnotation

      AbstractMergedAnnotation()
  • 方法详细资料

    • isDirectlyPresent

      public boolean isDirectlyPresent()
      从接口复制的说明: MergedAnnotation
      Determine if the annotation is directly present on the source.

      A directly present annotation is one that the user has explicitly declared and not one that is meta-present or @Inherited.

      指定者:
      isDirectlyPresent 在接口中 MergedAnnotation<A extends Annotation>
      返回:
      true if the annotation is directly present
    • isMetaPresent

      public boolean isMetaPresent()
      从接口复制的说明: MergedAnnotation
      Determine if the annotation is meta-present on the source.

      A meta-present annotation is an annotation that the user hasn't explicitly declared, but has been used as a meta-annotation somewhere in the annotation hierarchy.

      指定者:
      isMetaPresent 在接口中 MergedAnnotation<A extends Annotation>
      返回:
      true if the annotation is meta-present
    • hasNonDefaultValue

      public boolean hasNonDefaultValue(String attributeName)
      从接口复制的说明: MergedAnnotation
      Determine if the specified attribute name has a non-default value when compared to the annotation declaration.
      指定者:
      hasNonDefaultValue 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      true if the attribute value is different from the default value
    • getByte

      public byte getByte(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required byte attribute value from the annotation.
      指定者:
      getByte 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a byte
    • getByteArray

      public byte[] getByteArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required byte array attribute value from the annotation.
      指定者:
      getByteArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a byte array
    • getBoolean

      public boolean getBoolean(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required boolean attribute value from the annotation.
      指定者:
      getBoolean 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a boolean
    • getBooleanArray

      public boolean[] getBooleanArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required boolean array attribute value from the annotation.
      指定者:
      getBooleanArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a boolean array
    • getChar

      public char getChar(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required char attribute value from the annotation.
      指定者:
      getChar 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a char
    • getCharArray

      public char[] getCharArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required char array attribute value from the annotation.
      指定者:
      getCharArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a char array
    • getShort

      public short getShort(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required short attribute value from the annotation.
      指定者:
      getShort 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a short
    • getShortArray

      public short[] getShortArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required short array attribute value from the annotation.
      指定者:
      getShortArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a short array
    • getInt

      public int getInt(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required int attribute value from the annotation.
      指定者:
      getInt 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as an int
    • getIntArray

      public int[] getIntArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required int array attribute value from the annotation.
      指定者:
      getIntArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as an int array
    • getLong

      public long getLong(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required long attribute value from the annotation.
      指定者:
      getLong 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a long
    • getLongArray

      public long[] getLongArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required long array attribute value from the annotation.
      指定者:
      getLongArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a long array
    • getDouble

      public double getDouble(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required double attribute value from the annotation.
      指定者:
      getDouble 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a double
    • getDoubleArray

      public double[] getDoubleArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required double array attribute value from the annotation.
      指定者:
      getDoubleArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a double array
    • getFloat

      public float getFloat(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required float attribute value from the annotation.
      指定者:
      getFloat 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a float
    • getFloatArray

      public float[] getFloatArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required float array attribute value from the annotation.
      指定者:
      getFloatArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a float array
    • getString

      public String getString(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required string attribute value from the annotation.
      指定者:
      getString 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a string
    • getStringArray

      public String[] getStringArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required string array attribute value from the annotation.
      指定者:
      getStringArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a string array
    • getClass

      public <T> Class<T> getClass(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required class attribute value from the annotation.
      指定者:
      getClass 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a class
    • getClassArray

      public <T> Class<T>[] getClassArray(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get a required class array attribute value from the annotation.
      指定者:
      getClassArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      the value as a class array
    • getEnum

      public <E extends Enum<E>> E getEnum(String attributeName, Class<E> type)
      从接口复制的说明: MergedAnnotation
      Get a required enum attribute value from the annotation.
      指定者:
      getEnum 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      type - the enum type
      返回:
      the value as a enum
    • getEnumArray

      public <E extends Enum<E>> E[] getEnumArray(String attributeName, Class<E> type)
      从接口复制的说明: MergedAnnotation
      Get a required enum array attribute value from the annotation.
      指定者:
      getEnumArray 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      type - the enum type
      返回:
      the value as a enum array
    • getValue

      public Optional<Object> getValue(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get an optional attribute value from the annotation.
      指定者:
      getValue 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      an optional value or Optional.empty() if there is no matching attribute
    • getValue

      public <T> Optional<T> getValue(String attributeName, Class<T> type)
      从接口复制的说明: MergedAnnotation
      Get an optional attribute value from the annotation.
      指定者:
      getValue 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      type - the attribute type. Must be compatible with the underlying attribute type or Object.class.
      返回:
      an optional value or Optional.empty() if there is no matching attribute
    • getDefaultValue

      public Optional<Object> getDefaultValue(String attributeName)
      从接口复制的说明: MergedAnnotation
      Get the default attribute value from the annotation as specified in the annotation declaration.
      指定者:
      getDefaultValue 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      attributeName - the attribute name
      返回:
      an optional of the default value or Optional.empty() if there is no matching attribute or no defined default
    • filterDefaultValues

      public MergedAnnotation<A> filterDefaultValues()
      从接口复制的说明: MergedAnnotation
      Create a new view of the annotation with all attributes that have default values removed.
      指定者:
      filterDefaultValues 在接口中 MergedAnnotation<A extends Annotation>
      返回:
      a filtered view of the annotation without any attributes that have a default value
      另请参阅:
    • asAnnotationAttributes

      public AnnotationAttributes asAnnotationAttributes(MergedAnnotation.Adapt... adaptations)
      从接口复制的说明: MergedAnnotation
      Create a new mutable AnnotationAttributes instance from this merged annotation.

      The adaptations may be used to change the way that values are added.

      指定者:
      asAnnotationAttributes 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      adaptations - the adaptations that should be applied to the annotation values
      返回:
      an immutable map containing the attributes and values
    • synthesize

      public Optional<A> synthesize(Predicate<? super MergedAnnotation<A>> condition) throws NoSuchElementException
      从接口复制的说明: MergedAnnotation
      Optionally create a type-safe synthesized version of this annotation based on a condition predicate.

      The result is synthesized using a JDK Proxy and as a result may incur a computational cost when first invoked.

      Consult the documentation for MergedAnnotation.synthesize() for an explanation of what is considered synthesizable.

      指定者:
      synthesize 在接口中 MergedAnnotation<A extends Annotation>
      参数:
      condition - the test to determine if the annotation can be synthesized
      返回:
      an optional containing the synthesized version of the annotation or an empty optional if the condition doesn't match
      抛出:
      NoSuchElementException - on a missing annotation
      另请参阅:
    • synthesize

      public A synthesize()
      从接口复制的说明: MergedAnnotation
      Create a type-safe synthesized version of this merged annotation that can be used directly in code.

      The result is synthesized using a JDK Proxy and as a result may incur a computational cost when first invoked.

      If this merged annotation was created from a map of annotation attributes or default attribute values, those attributes will always be synthesized into an annotation instance.

      If this merged annotation was created from an annotation instance, that annotation will be returned unmodified if it is not synthesizable. An annotation is considered synthesizable if it has not already been synthesized and one of the following is true.

      • The annotation declares attributes annotated with @AliasFor.
      • The annotation is a composed annotation that relies on convention-based annotation attribute overrides in meta-annotations.
      • The annotation declares attributes that are annotations or arrays of annotations that are themselves synthesizable.
      指定者:
      synthesize 在接口中 MergedAnnotation<A extends Annotation>
      返回:
      a synthesized version of the annotation or the original annotation unmodified
    • getRequiredAttributeValue

      private <T> T getRequiredAttributeValue(String attributeName, Class<T> type)
    • getAttributeValue

      @Nullable protected abstract <T> T getAttributeValue(String attributeName, Class<T> type)
      Get the underlying attribute value.
      参数:
      attributeName - the attribute name
      type - the type to return (see MergedAnnotation class documentation for details)
      返回:
      the attribute value or null if the value is not found and is not required
      抛出:
      IllegalArgumentException - if the source type is not compatible
      NoSuchElementException - if the value is required but not found
    • createSynthesizedAnnotation

      protected abstract A createSynthesizedAnnotation()
      Factory method used to create the synthesized annotation.

      If the source is an annotation that is not synthesizable, it will be returned unmodified.

      Consult the documentation for MergedAnnotation.synthesize() for an explanation of what is considered synthesizable.