Simple Getter/Setter comments

前端 未结 14 1049
悲&欢浪女
悲&欢浪女 2020-12-04 07:16

What convention do you use to comment getters and setters? This is something I\'ve wondered for quite some time, for instance:

/**
 * (1a) what do you put h         


        
14条回答
  •  没有蜡笔的小新
    2020-12-04 07:40

    Why don't they just include a reference tag to let you comment the field value and the reference from getters and setters.

    /**
    * The adjustment factor for the bar calculation.
    * @HasGetter
    * @HasSetter
    */
    private String foo;
    
    public String getFoo() {
      return foo;
    }
    
    public void setFoo() {
      this foo = foo;
    }
    

    So that the documentation applies to the getter and setter as well as the field (if private javadocs is turned on that is).

提交回复
热议问题