
本文共 3190 字,大约阅读时间需要 10 分钟。
���������Annotation������Java���������������������������������������JDK 5.0������������������������������������������������������������������������������������������������������������������������@���������������������������������������������������������������������������������������name=value���������������������������������������������������������������������������������������������������������������������������������������������������
���������������
- ���������������������������������������������������������������������������������������������������
- ���������������������������������������������������������������������������������������������������������
- ���������������������������������������Spring���MyBatis���������������������������������������������������
JDK������������
JDK���������������������������������������������
������������Meta-Annotation���
������������������������������������������������������������
- ���������@Retention(RetentionPolicy.SOURCE) ���������������������������������������
- ���������@Target(ElementType.METHOD) ������������������������������������
���������������
������������������������������������������������������������������������
������������������
������@interface
���������������������������������������������������Annotation
���@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)public @interface MyAnnotation { String value() default "���������"; //������������������
������������������
���������������������������������������������������������String���Class������������������������������������������������������������������������������@MyAnnotation("������������") class TestClass { // ...
������������������������
������Class
������API���������������������Classcls = TestClass.class;MyAnnotation annotation = cls.getAnnotation(MyAnnotation.class);String value = annotation.value();
���������������������������
���������������������
@author
���@version
���@see
���������������Javadoc������������������������������������
@param
���@return
���@exception
���������������������������������������������������������
@SuppressWarnings
���������������������������������������Spring���������������������������������������bean������������������������������
���������������
���������������������������������
@Target(ElementType unlawApi)@Retention(RetentionPolicy.RUNTIME)public @interface IllegalAPI { String reason() default "���������";}
���������������
@IllegalAPI(reason = "������������������")public class IllegalFunction { // ...}
������������������������������������������Java���������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
