本文主要是介绍@Documented Annotation的使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
@Documented Annotation的使用:
@Documented Annotation的作用是在生成javadoc文档的时候将该Annotation也写入到文档中。
java 代码
- package com.test;
- import java.lang.annotation.Documented;
- @Documented
- public @interface DocumentTest {
- String hello();
- }
java 代码
- package com.test;
- public class DocumentClass {
- /**
- * this is method of doSomething
- */
- @DocumentTest(hello = "yahaitt")
- public void doSomething()
- {
- System.out.println("do something");
- }
- /**
- * this is method of say
- */
- public void say()
- {
- System.out.println("say");
- }
- }
生成的doc文件中如下:
doSomething
@DocumentTest(hello="yahaitt") public void doSomething()
- this is method of doSomething
这篇关于@Documented Annotation的使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!