DBMNG数据库管理与应用

独立思考能力,对于从事科学研究或其他任何工作,都是十分必要的。
当前位置:首页 > MySQL > 常见问题

AnnotatedElement接口


12.4.4 AnnotatedElement接口

前面例子中使用的getAnnotation()和getAnnotations()方法是由AnnotatedElement接口定义的,该接口在java.lang.reflect包中定义。这个接口支持注解反射,并且类Method、Field、Constructor、Class以及Package也都实现了该接口。

Annotation[ ] getDeclaredAnnotations( ) 
Annotation[ ] getDeclaredAnnotations( ) 上述方法返回调用对象中存在的所有非继承注解。第二个方法是isAnnotationPresent(),该方法的一般形式如下所示:
boolean isAnnotationPresent(Class<? extends Annotation> annoType) 
如果annoType指定的注解与调用对象相关联,那么该方法返回true,否则返回false。

本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号