pra*_*jvs 59 java eclipse annotations
@Documentedjava 中注释的目的是什么?
我看到了文档,但从中得不到多少.有人可以借助一个明确的例子指出
Adr*_*Cox 54
@Documented是一个元注释.您@Documented在定义注释时应用,以确保使用注释的类在其生成的JavaDoc中显示此内容.我没有看到太多使用它,但这里有一个例子.之前的一个问题表明它在Eclipse中不能自动运行,但是我已经在Eclipse 3.6中进行了测试,并且我的注释出现在JavaDoc弹出窗口中,无论我是否将@Documented注释附加到它们.
这是Spring的一个例子,它确保事务方法在JavaDoc中标记为:
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Transactional {
Gan*_*nus 35
如果我们的注释(例如@InWork)是@Documented,那么对于具有该@InWork注释的每个类,由javadoc生成的文本将包含@InWork文本,作为对注释的引用.
注解:
@Documented
@Inherited  // for descenders of the annotation to have the @Documented feature automatically
@Retention(RetentionPolicy.RUNTIME) // must be there
public @interface InWork {
    String value();
}
注释目标:
/**
 * Annotated class.
 */
@InWork(value = "")
public class MainApp {...}
javadoc文本:

因此,您必须决定是否应在javadoc文本中显示注释,如果是,则设置@Documented为它.
以上信息摘自Oracle文档.
请注意,在Eclipse中,您将在javadoc生成的文本中看到所有注释,无论是否@Documented.  
4.3版仍然是正确的.