Generate getters and setters
To generate getters and setters, do the following:
- Create the fields you want in the class then press Alt+Shift+S, R. A dialog will pop up allowing you to choose the fields you want to generate getters and setters for.
- Click Select All to create getters/setters for all fields. Of course you can choose individual fields as required.
- Change Insertion point to Last Member. This tells Eclipse that you want to put the methods at the bottom of the class. This is normally the best option for me as I want them out of the way.
- Click Ok. Eclipse will create the getters and setters for you.
Here’s an example of what the dialog should look like.
