开发者

Java docstringes through private variable in class

public static class cls{
    private String text;
    public String getText(){
        return text;
    }
}

Is it possible to show the text variable in the docstrings of 开发者_高级运维of cls in Java without having to copypaste the content?


I'm not sure what you are trying to do. You could link to the variable from your JavaDoc using on of these two ways:

/**
 * The cls class
 * see {@link cls#text} or
 * @see cls#text
 */
public static class cls {
    private String text;
...

You could then attach a JavaDoc to this variable and describe there what you need to say. To my knowledge there is no way to just display a line of code inside the JavaDoc other than copy and paste. But you can improve the formatting with HTML, if you like:

/**
 * The cls class, see this field:
 * <code>private String text;</code>
 */
public static class cls {
    private String text;
...

Hope that helps, but the question remains: Why do you want to expose implementation, if there is a public getter?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜