codestyle;把以前的javadoc注释或之后? [英] codestyle; put javadoc before or after annotation?

查看:255
本文介绍了codestyle;把以前的javadoc注释或之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,这不是最重要的问题,但我只是意识到,我可以把javadoc注释块之前或之后的注释。我们希望以什么作为采用编码标准?

  / **
 *这是注释前javadoc注释
 * /
@零件
公共类MyClass的{    @Autowired
    / **
     *这是注释后javadoc注释
     * /
    私人MyOtherClass等;
}


解决方案

注释之前,由于注释为code,它属于类。
请参阅官方文档与javadoc的 例子。

下面是随便举个例子,我发现在的另一位官员的Java页面

  / **
 *从列表中删除多个项目。
 *
 * @德precated不供公众使用。
 *这种方法预计将仅保留作为一个包
 *私有方法。取而代之
 * {@link #remove(INT)}和{@link #removeAll()}
 * /
@德precated市民同步无效delItems(INT开始,诠释完){
    ...
}

I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a coding standard?

/**
 * This is a javadoc comment before the annotation 
 */
@Component
public class MyClass {

    @Autowired
    /**
     * This is a javadoc comment after the annotation
     */
    private MyOtherClass other;
}

解决方案

Before the annotation, since the annotation is code that "belongs" to the class. See examples with javadoc in the official documentation.

Here's random example I found in another official Java page:

/**
 * Delete multiple items from the list.
 *
 * @deprecated  Not for public use.
 *    This method is expected to be retained only as a package
 *    private method.  Replaced by
 *    {@link #remove(int)} and {@link #removeAll()}
 */
@Deprecated public synchronized void delItems(int start, int end) {
    ...
}

这篇关于codestyle;把以前的javadoc注释或之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆