Documented:说明该注解将会被包含在JavaDoc文档中,我们常见的JDK帮助文档参考手册就是JavaDoc。

  1. 编写一个普通的注解,并且保证(RetentionPolicy.RUNTIME)
package javadoc;import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;@Retention(RetentionPolicy.RUNTIME)
public @interface CommonAnotation {String value();}
  1. 编写一个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();
}
  1. 编写一个测试类
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();}
}
  1. 使用Eclipse的javadoc工具导出,右击需要导出的文件,找到Export。




这个注解对程序没什么影响,只是在对于生成帮助文档时有帮助。

Documented元注解相关推荐

  1. @Target、@Retention、@Documented元注解简介

    @Target.@Retention.@Documented元注解简介 元注解 @Documented @Retention @Target 元注解 首先,用来修饰注解的注解被称为元注解,如以下代码中 ...

  2. 【Java 注解】自定义注解 ( 元注解 )

    文章目录 一.元注解 二.常用的元注解类型 三.@Target 元注解 四.@Retention 元注解 五.@Documented 元注解 六.@Documented 元注解 一.元注解 元注解 是 ...

  3. JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited)。

    jdk1.5起开始提供了4个元注解,用来定义自定义注解的注解,它们分别是: @Target 指定注解使用的目标范围(类.方法.字段等),其参考值见类的定义:java.lang.annotation.E ...

  4. JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited)

    转载自 JAVA元注解@interface详解(@Target,@Documented,@Retention,@Inherited) jdk1.5起开始提供了4个元注解,用来定义自定义注解的注解,它们 ...

  5. 四种元注解(target、retention、documented、inherited)

    目录 1.元注解(meta-annotation): @Target: @Retention: @Documented: @Inherited: 自定义注解: 1.元注解(meta-annotatio ...

  6. 元注解@Target、@Retention、@Documented、@Inherited的用法

    元注解(meta-annotation)的作用就是负责注解其他注解,Java5定义了元注解类型,他们被用来提供对其它annotation类型做说明. @Target @Retention @Docum ...

  7. java 元注解 @Retention @Inherited @Documented

    目录 一 笔记 二 使用java 元注解 @Retention @Inherited @Documented,自定义注解类@MyAnnotation6 三 使用自定义注解类@MyAnnotation6 ...

  8. java 四种元注解@Target、@Retention、@Documented 和@Inherited

    java 四种元注解@Target.@Retention.@Documented 和@Inherited @Target 表示该注解用于什么地方,可能的值在枚举类 ElemenetType 中,包括: ...

  9. java元注解-@Documented

    java元注解-@Documented @Documented @Retention(value=RUNTIME) @Target(value=ANNOTATION_TYPE) public @int ...

最新文章

  1. 一本跳进挨踢生活圈的日记(南京站)
  2. MySQL-分库分表初探
  3. docker报错:Unable to get pid of LinuxThreads manager thread及openjdk-alpine镜像无法打印线程堆栈和内存堆栈问题
  4. 如何压测基于容器服务ACK托管的DUBBO服务
  5. 一文搞定C语言指针问题
  6. 程序员是如何处理密码的?
  7. linux临时网络配置
  8. Linux的工作队列work queue和延时工作队列
  9. 许多自己正在总结的东东
  10. 引用了System.Configuration命名空间,却找不到ConfigurationManager类
  11. autojs遍历当前页面所有控件_解放双手,手机自动化神器-AutoJS的使用
  12. 【vue】vue中如何实现SPA 单页面应用_09
  13. BatchOutput PDF 2.2.32 Mac 破解版 PDF文档自动批量打印工具
  14. Createjs的控件 BitMap、MovieClip、Sprite
  15. BIMC中国最权威的电子商务托管运营商
  16. 学计算机的人c语言修仙评价,评《C语言修仙》 非渊静者 评《C语言修仙》 时间:2019-05-04 11:55:19...
  17. PAT_乙级_1004_筱筱
  18. 立方体图片的在线绘制与制作
  19. python定义整数_Python | 程序定义一个整数值并打印
  20. Interpreter(解释器模式)行为型

热门文章

  1. 阿尔比恩恩android更新包,最新更新补丁机翻,简单校对版
  2. uboot启动流程详解(3)-cpu_init_cp15
  3. redis之紧凑的rdb文件
  4. MATLAB plot函数
  5. excel函数公式:常用高频公式应用总结 上篇
  6. JAVA 攻城狮 第十六天
  7. re.IGNORECASE --以不区分大小写的方式对文本做查找和替换
  8. C#中的string和StringBuilder
  9. Excel表格中的通配符,有你意想不到的功能。
  10. 咖啡馆如何进行商圈分析确定选址地点