开发者

Auto generation of comments for getters and setters in Eclipse

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜