Reputation: 39
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?
Upvotes: 1
Views: 758
Reputation: 2019
Yet another method: move your cursor over the field definition, press Ctrl+1, and select "create getter and setter for (field)".
Upvotes: 4
Reputation: 274552
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.
Upvotes: 3
Reputation: 114767
Fastest way for people that don't need a mouse anymore: with an editor in focus, press ALT+s, r.
Upvotes: 5
Reputation: 70564
editor view -> right click -> source -> generate getters and setters
Upvotes: 3