类 AttributeMethods
java.lang.Object
cn.taketoday.core.annotation.AttributeMethods
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
-
字段概要
字段修饰符和类型字段说明private final Class<? extends Annotation>final Method[](专用程序包) static final ConcurrentReferenceHashMap<Class<? extends Annotation>,AttributeMethods> private final boolean[]final booleanDetermine if at least one of the attribute methods has a default value.final booleanDetermine if at least one of the attribute methods is a nested annotation.private static final Comparator<Method>(专用程序包) static final AttributeMethods -
构造器概要
构造器限定符构造器说明privateAttributeMethods(Class<? extends Annotation> annotationType, Method[] attributes) -
方法概要
修饰符和类型方法说明private voidassertAnnotation(Annotation annotation) (专用程序包) booleancanThrowTypeNotPresentException(int index) Determine if the attribute at the specified index could throw aTypeNotPresentExceptionwhen accessed.private static AttributeMethodscompute(Class<? extends Annotation> annotationType) (专用程序包) static StringCreate a description for the given attribute method suitable to use in exception messages and logs.(专用程序包) static StringCreate a description for the given attribute method suitable to use in exception messages and logs.(专用程序包) static AttributeMethodsforAnnotationType(Class<? extends Annotation> annotationType) Get the attribute methods for the given annotation type.(专用程序包) Methodget(int index) Get the attribute at the specified index.(专用程序包) MethodGet the attribute with the specified name ornullif no matching attribute exists.(专用程序包) intGet the index of the specified attribute, or-1if the attribute is not in this collection.(专用程序包) intGet the index of the attribute with the specified name, or-1if there is no attribute with the name.private static booleanisAttributeMethod(Method method) (专用程序包) booleanisValid(Annotation annotation) Determine if values from the given annotation can be safely accessed without causing anyTypeNotPresentExceptions.(专用程序包) intsize()Get the number of attributes in this collection.(专用程序包) voidvalidate(Annotation annotation) Check if values from the given annotation can be safely accessed without causing anyTypeNotPresentExceptions.
-
字段详细资料
-
NONE
-
cache
-
methodComparator
-
annotationType
-
attributes
-
canThrowTypeNotPresentException
private final boolean[] canThrowTypeNotPresentException -
hasDefaultValueMethod
public final boolean hasDefaultValueMethodDetermine if at least one of the attribute methods has a default value.trueif there is at least one attribute method with a default value -
hasNestedAnnotation
public final boolean hasNestedAnnotationDetermine if at least one of the attribute methods is a nested annotation.trueif there is at least one attribute method with a nested annotation type
-
-
构造器详细资料
-
AttributeMethods
-
-
方法详细资料
-
isValid
Determine if values from the given annotation can be safely accessed without causing anyTypeNotPresentExceptions.- 参数:
annotation- the annotation to check- 返回:
trueif all values are present- 另请参阅:
-
validate
Check if values from the given annotation can be safely accessed without causing anyTypeNotPresentExceptions. In particular, this method is designed to cover Google App Engine's late arrival of such exceptions forClassvalues (instead of the more typical earlyClass.getAnnotations() failure.- 参数:
annotation- the annotation to validate- 抛出:
IllegalStateException- if a declaredClassattribute could not be read- 另请参阅:
-
assertAnnotation
-
get
Get the attribute with the specified name ornullif no matching attribute exists.- 参数:
name- the attribute name to find- 返回:
- the attribute method or
null
-
get
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 aTypeNotPresentExceptionwhen accessed.- 参数:
index- the index of the attribute to check- 返回:
trueif the attribute can throw aTypeNotPresentException
-
indexOf
Get the index of the attribute with the specified name, or-1if there is no attribute with the name.- 参数:
name- the name to find- 返回:
- the index of the attribute, or
-1
-
indexOf
Get the index of the specified attribute, or-1if 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
Get the attribute methods for the given annotation type.- 参数:
annotationType- the annotation type- 返回:
- the attribute methods for the annotation type
-
compute
-
isAttributeMethod
-
describe
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
Create a description for the given attribute method suitable to use in exception messages and logs.- 参数:
annotationType- the annotation typeattributeName- the attribute name- 返回:
- a description of the attribute
-