java - Eclipse: How to automatically generate getter when adding a field? -
i using tdd, , have typical coding pattern, using eclipse autocreate methods , fields code unit test. example:
type name of method doesn't exist, e.g:
myobj.setvalue(somevalue);click on little red error mark in ide create "setvalue" method.
type inside of setvalue method:
public void setvalue(string value) { this.value = value; }click red error mark auto-create private field (called "value in case");
so @ point, eclipse auto-create getter method, without having using source -> generate getters , setters menu.
i saw question: how force eclipse prompt create getter , setter when doesn't automatically seems imply eclipse this, couldn't find configure that.
is there way configure eclipse automatically add setter/getters when adding new private variable?
update: clarify further, i'm looking saw in spring roo documentation. if take @ "how works" section, describes how framework automatically adds additional methods class, whenever add private variable. (my preference not run process that, however, , not cruft seems add). hoping eclipse had similar.
when move mouse above name of variable, can select "create getter , setter varname" in popup menu.
or can create shortcut so. preferences -> general -> keys. in search box enter "getter" , you´ll find it.
Comments
Post a Comment