问题描述
什么是 @Documented
在Java注释的目的是什么?
What's the purpose of @Documented
annotation in java?
我看到的文件,但不能从中获得太多。可有人指出,与明显的例子的帮助
I saw the documentation, but could not get much from it. Can someone point out with the help of an clear example
推荐答案
@Documented
是元注解。定义一个注释的时候,要确保使用注释显示这在他们生成的JavaDoc类你申请 @Documented
。我从来没见过多大用处的,但there在这里一个例子。前面一个问题表明它doesn't在Eclipse 自动工作,但我已经在Eclipse 3.6的测试,而我的注释出现在JavaDoc弹出与否我附上 @Documented
注释给他们
@Documented
is a meta-annotation. You apply @Documented
when defining an annotation, to ensure that classes using your annotation show this in their generated JavaDoc. I've not seen much use of it, but there is an example here. An earlier question suggests that it doesn't work automatically in Eclipse, but I've tested in Eclipse 3.6, and my annotations appear in the JavaDoc popups whether or not I attach the @Documented
annotation to them.
下面是春天,这确保了交易方法是在JavaDoc标记为这样一个例子:
Here's an example from Spring, which ensures that transactional methods are marked as such in the JavaDoc:
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Transactional {
这篇关于在java中@Documented注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!