views:

52

answers:

4

I added two private fields to my Java class.

Eclipse prompted me to automatically create a getter and setter for one of them.

How do I get it to do the same for the other one that it 'forgot' about?

+3  A: 

editor view -> right click -> source -> generate getters and setters

meriton
+4  A: 

Fastest way for people that don't need a mouse anymore: with an editor in focus, press ALT+s, r.

Andreas_D
+3  A: 

To create a getter/setter the fastest way is to type get (or set) + Ctrl + Space and you will see it in the pop-up proposal list.

dogbane
+2  A: 

Yet another method: move your cursor over the field definition, press Ctrl+1, and select "create getter and setter for (field)".

matiasg