문제

Eclipse have an option of generating getters and setters from respective variables. Is there an option or settings by which I can also generate the comments for getters and setters?

e.g. If my variable name is

protected boolean isActive;

Then while I generate getter for this, can I also get the auto generated comment block like this -

/**
 * Gets the value of the isActive property.
 * 
 * @return
 *     possible object is
 *     {@link Boolean }
 *     
 */
public Boolean getIsActive() {
    return isActive;
}

Would be great if this thing is possible. Also is that comment block customizable?

도움이 되었습니까?

해결책

Go to Preferences>Java>Code Style>Code Templates and then change the Comments>Getters template. You also want to make sure the 'Automatically add comments for new methods and types' checkbox is selected.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top