类 AttributeMethods

java.lang.Object
cn.taketoday.core.annotation.AttributeMethods

final class AttributeMethods extends Object
Provides a quick way to access the attribute methods of an Annotation with consistent ordering as well as a few useful utility methods.
从以下版本开始:
4.0
作者:
Phillip Webb, Harry Yang
  • 字段详细资料

    • NONE

      static final AttributeMethods NONE
    • cache

    • methodComparator

      private static final Comparator<Method> methodComparator
    • annotationType

      @Nullable private final Class<? extends Annotation> annotationType
    • attributes

      public final Method[] attributes
    • canThrowTypeNotPresentException

      private final boolean[] canThrowTypeNotPresentException
    • hasDefaultValueMethod

      public final boolean hasDefaultValueMethod
      Determine if at least one of the attribute methods has a default value.

      true if there is at least one attribute method with a default value

    • hasNestedAnnotation

      public final boolean hasNestedAnnotation
      Determine if at least one of the attribute methods is a nested annotation.

      true if there is at least one attribute method with a nested annotation type

  • 构造器详细资料

  • 方法详细资料

    • isValid

      boolean isValid(Annotation annotation)
      Determine if values from the given annotation can be safely accessed without causing any TypeNotPresentExceptions.
      参数:
      annotation - the annotation to check
      返回:
      true if all values are present
      另请参阅:
    • validate

      void validate(Annotation annotation)
      Check if values from the given annotation can be safely accessed without causing any TypeNotPresentExceptions. In particular, this method is designed to cover Google App Engine's late arrival of such exceptions for Class values (instead of the more typical early Class.getAnnotations() failure.
      参数:
      annotation - the annotation to validate
      抛出:
      IllegalStateException - if a declared Class attribute could not be read
      另请参阅:
    • assertAnnotation

      private void assertAnnotation(Annotation annotation)
    • get

      @Nullable Method get(String name)
      Get the attribute with the specified name or null if no matching attribute exists.
      参数:
      name - the attribute name to find
      返回:
      the attribute method or null
    • get

      Method get(int index)
      Get the attribute at the specified index.
      参数:
      index - the index of the attribute to return
      返回:
      the attribute method
      抛出:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
    • canThrowTypeNotPresentException

      boolean canThrowTypeNotPresentException(int index)
      Determine if the attribute at the specified index could throw a TypeNotPresentException when accessed.
      参数:
      index - the index of the attribute to check
      返回:
      true if the attribute can throw a TypeNotPresentException
    • indexOf

      int indexOf(String name)
      Get the index of the attribute with the specified name, or -1 if there is no attribute with the name.
      参数:
      name - the name to find
      返回:
      the index of the attribute, or -1
    • indexOf

      int indexOf(Method attribute)
      Get the index of the specified attribute, or -1 if the attribute is not in this collection.
      参数:
      attribute - the attribute to find
      返回:
      the index of the attribute, or -1
    • size

      int size()
      Get the number of attributes in this collection.
      返回:
      the number of attributes
    • forAnnotationType

      static AttributeMethods forAnnotationType(@Nullable Class<? extends Annotation> annotationType)
      Get the attribute methods for the given annotation type.
      参数:
      annotationType - the annotation type
      返回:
      the attribute methods for the annotation type
    • compute

      private static AttributeMethods compute(Class<? extends Annotation> annotationType)
    • isAttributeMethod

      private static boolean isAttributeMethod(Method method)
    • describe

      static String describe(@Nullable Method attribute)
      Create a description for the given attribute method suitable to use in exception messages and logs.
      参数:
      attribute - the attribute to describe
      返回:
      a description of the attribute
    • describe

      static String describe(@Nullable Class<?> annotationType, @Nullable String attributeName)
      Create a description for the given attribute method suitable to use in exception messages and logs.
      参数:
      annotationType - the annotation type
      attributeName - the attribute name
      返回:
      a description of the attribute
    • getName

      static String getName(Class<?> clazz)