Generate getters and setters in Eclipse IDE

Still busy writing setters and getters method manually? Actually, Eclipse IDE is able to help you generate the setters and getters method automatically, and this feature is bundle with Eclipse IDE long time ago, surprisingly, many Java developers are not aware of it?

See following steps to show you how.

1. Java Pojo

A simple User.java, with 4 fields, but no getters and setters method.

2. Generate It

Right click on the file, select “Source” –> “Generate Getters and Setters…”

Choose which field you want to generate, and click on “OK” button.

3. Done

All selected getters and setters methods will be generated automatically.