单行上的Javadoc多个变量

时间:2012-03-11 20:09:32

标签: java javadoc

我有一个类似以下的课程......

class A{

/**
 * Blah blah
 */
 Type1 var;

/**
 * What do I do here?
 */
 Type2 var11, var12;

}

如果javadoc var11和var12如果它们都在同一行上怎么样?

我很想知道这是否可能,我知道我可以把它们放在一条线上并从那里开始javadoc。

2 个答案:

答案 0 :(得分:10)

我很好奇所以我试了一下

/**
 * data stuff
 */
 int x , y ;

生成的javadoc重复了x和y的相同doc注释。 我想如果两个字段基本相同而且存在细微差别,则此行为将非常有用。

class Circle
{
    ....
    /**
     * center coordinates
     * The x/y coordinate of the center of this circle.
     */
     int x , y ;

答案 1 :(得分:0)

遗憾的是,没有办法区分多个变量的单行声明:(

然而,注意这样做的好处是允许单个javadoc为分类变量提供文档,否则可能会占用不必要的行。

/**
 * custom colors (MUST BE DISPOSED!)
 */
Color lightblue, someotherblue, lightred;

当然这也可以与初始化相结合

/**
*  These are the spec's behind batch-box font size / Height / Width
*/
private int iFontHeight = 9, iboxheight = 58, iboxwidth = 125;