How to deal with repetition of JavaDoc comments?

I was wondering what is the best way to document this potential class Point:

public class Point {
    /* the X coordinate of this point */
    private int x;
    /* the Y coordinate of this point */
    private int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}

My specific problem is repeating between attributes xand yand their respective getters and setters, as well as with constructor arguments.

It’s not that I was developing a public API or something like that, it’s not a problem for me to have a general comment regarding a variable, and then if the recipient and the setter have the same text, for example. I just would like to avoid repeating comments in my own inner code. Is there a way to bind an argument getX()and int xconstructor to an attribute x, for example?

thank

+5
2

getX() int x x, ?

, , . :

  • ( )
  • X , - () Javadoc
+1

JavaDoc getters.

0

All Articles