记录未完成的开发工作 - 注释

时间:2017-09-17 12:52:30

标签: java annotations javac annotation-processing java-5

使用Javadoc将类型为workWithAnnotMethodConstructorAnnotationPackage的对象记录为未完成在开发中,下面是代码,

src
   package1
      package-info.java
      Unfinished.java
   test
      package-info.java
      workWithAnnot.java

包1 / package-info.java

@Unfinished("Package scope")
package package1;

包1 / Unfinished.java

package package1;

import java.lang.annotation.*;

@Unfinished("Just articleware")
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE,ElementType.METHOD, ElementType.CONSTRUCTOR,
            ElementType.ANNOTATION_TYPE, ElementType.PACKAGE})
@Inherited
public @interface Unfinished {
    public enum Priority {LOW, MEDIUM, HIGH}
    String value();
    String[] owners() default "";
    Priority priority() default Priority.MEDIUM;
}

测试/ workWithAnnot.java

package test;
import package1.Unfinished;
import package1.Unfinished.Priority;

@Unfinished(
        value = "Class Scope",
        priority = Priority.LOW
        )
public class workWithAnnot {

    @Unfinished(owners = "xyz", value="Method scope")
    public void foo() {

    }

    @Unfinished(owners = "Sham", value="Method scope")
    public void bar() {

    }
}

测试/ package-info.java

@Unfinished("Package scope")
package test;

import package1.Unfinished;

Javadoc将Package类型的对象显示为未完成的Java语法但不是作为文档(简体中文):

  

@Unfinished(value =" Package scope")

     

包装测试

Javadoc在Java语法中将workWithAnnot类型的对象显示为未完成但未作为文档显示:

  

@Unfinished(value =" Class Scope",                   优先级= LOW)

     

公共类workWithAnnot扩展java.lang.Object

Javadoc在Java语法中将Method类型的对象显示为未完成但未作为文档显示:

  

FOO

     

@Unfinished(所有者=" XYZ&#34 ;,                   value ="方法范围")

     

public void foo()

@Documented注释可以解决此问题吗?

我是否需要为新的自定义注释编写编译时注释处理器而不是使用元注释(@Documented)?

0 个答案:

没有答案