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:

  1. type name of method doesn't exist, e.g:

    myobj.setvalue(somevalue);

  2. click on little red error mark in ide create "setvalue" method.

  3. type inside of setvalue method:

    public void setvalue(string value) { this.value = value; }

  4. 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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -