Javadoc multiple variables on single line

天大地大妈咪最大 提交于 2019-12-01 14:39:52

问题


I have a class like the following...

class A{

/**
 * Blah blah
 */
 Type1 var;

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

}

How can I javadoc var11, and var12 if they are both on the same line?

I am curious to see if this is possible, I know I can put them both on an individual line and javadoc from there.


回答1:


I was curious so I tried it out

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

The resulting javadoc repeated the same doc comments for both x and y. I imagine this behavior would be useful if two fields were essentially the same with minor differences.

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



回答2:


unfortunately there is no way to differentiate single line declaration of multiple variables :(

It may be useful to note however that the benefit of this does allow for a single javadoc to provide documentation for categorical variables which may otherwise take unnecessary lines.

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

of course this can be combined with initialization as well

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


来源:https://stackoverflow.com/questions/9658446/javadoc-multiple-variables-on-single-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!