Documented元注解
Documented:说明该注解将会被包含在JavaDoc文档中,我们常见的JDK帮助文档参考手册就是JavaDoc。
- 编写一个普通的注解,并且保证(RetentionPolicy.RUNTIME)
package javadoc;import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;@Retention(RetentionPolicy.RUNTIME)
public @interface CommonAnotation {String value();}
- 编写一个Documented的注解,同样保证(RetentionPolicy.RUNTIME)
package javadoc;import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DocumentAnotation {String value();
}
- 编写一个测试类
package javadoc;public class Main {@CommonAnotation("Hello CommonAnotation!")public void f1() {System.out.println("11111111111111111");}@DocumentAnotation("Hello DocumentAnotation!")public void f2() {System.out.println("22222222222222222");}public static void main(String[] args) {new Main().f1();new Main().f2();}
}
- 使用Eclipse的javadoc工具导出,右击需要导出的文件,找到Export。
这个注解对程序没什么影响,只是在对于生成帮助文档时有帮助。
Documented元注解相关推荐
- @Target、@Retention、@Documented元注解简介
@Target.@Retention.@Documented元注解简介 元注解 @Documented @Retention @Target 元注解 首先,用来修饰注解的注解被称为元注解,如以下代码中 ...
- 【Java 注解】自定义注解 ( 元注解 )
文章目录 一.元注解 二.常用的元注解类型 三.@Target 元注解 四.@Retention 元注解 五.@Documented 元注解 六.@Documented 元注解 一.元注解 元注解 是 ...
- JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited)。
jdk1.5起开始提供了4个元注解,用来定义自定义注解的注解,它们分别是: @Target 指定注解使用的目标范围(类.方法.字段等),其参考值见类的定义:java.lang.annotation.E ...
- JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited)
转载自 JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited) jdk1.5起开始提供了4个元注解,用来定义自定义注解的注解,它们 ...
- 四种元注解(target、retention、documented、inherited)
目录 1.元注解(meta-annotation): @Target: @Retention: @Documented: @Inherited: 自定义注解: 1.元注解(meta-annotatio ...
- 元注解@Target、@Retention、@Documented、@Inherited的用法
元注解(meta-annotation)的作用就是负责注解其他注解,Java5定义了元注解类型,他们被用来提供对其它annotation类型做说明. @Target @Retention @Docum ...
- java 元注解 @Retention @Inherited @Documented
目录 一 笔记 二 使用java 元注解 @Retention @Inherited @Documented,自定义注解类@MyAnnotation6 三 使用自定义注解类@MyAnnotation6 ...
- java 四种元注解@Target、@Retention、@Documented 和@Inherited
java 四种元注解@Target.@Retention.@Documented 和@Inherited @Target 表示该注解用于什么地方,可能的值在枚举类 ElemenetType 中,包括: ...
- java元注解-@Documented
java元注解-@Documented @Documented @Retention(value=RUNTIME) @Target(value=ANNOTATION_TYPE) public @int ...
最新文章
- 一本跳进挨踢生活圈的日记(南京站)
- MySQL-分库分表初探
- docker报错:Unable to get pid of LinuxThreads manager thread及openjdk-alpine镜像无法打印线程堆栈和内存堆栈问题
- 如何压测基于容器服务ACK托管的DUBBO服务
- 一文搞定C语言指针问题
- 程序员是如何处理密码的?
- linux临时网络配置
- Linux的工作队列work queue和延时工作队列
- 许多自己正在总结的东东
- 引用了System.Configuration命名空间,却找不到ConfigurationManager类
- autojs遍历当前页面所有控件_解放双手,手机自动化神器-AutoJS的使用
- 【vue】vue中如何实现SPA 单页面应用_09
- BatchOutput PDF 2.2.32 Mac 破解版 PDF文档自动批量打印工具
- Createjs的控件 BitMap、MovieClip、Sprite
- BIMC中国最权威的电子商务托管运营商
- 学计算机的人c语言修仙评价,评《C语言修仙》 非渊静者 评《C语言修仙》 时间:2019-05-04 11:55:19...
- PAT_乙级_1004_筱筱
- 立方体图片的在线绘制与制作
- python定义整数_Python | 程序定义一个整数值并打印
- Interpreter(解释器模式)行为型