getAnnotation

原文:http://www.apihome.cn/api/java/Field.html

public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
从接口 AnnotatedElement 复制的描述
如果存在该元素的指定类型的注释,则返回这些注释,否则返回 null。

 

指定者:
接口 AnnotatedElement 中的 getAnnotation
覆盖:
类 AccessibleObject 中的 getAnnotation
参数:
annotationClass - 对应于注释类型的 Class 对象
返回:
如果该元素的指定注释类型的注释存在于此对象上,则返回这些注释,否则返回 null
抛出:
NullPointerException - 如果给定的注释类为 null
从以下版本开始:
1.5
posted @ 2017-02-20 15:05  Timer©jiao  阅读(118)  评论(0)    收藏  举报