21 March 2011

Useful shortcut in Eclipse: Generate setters ang getters methods

When you  learn your first language (Java in these days) , then you get very excited when you practice implementing methods  ,so implementing setters and  getters is very orgasmic ... however , when you start doing bigger and bigger project then you discover that writing setters and getters is very boring and you start dreaming that these things can be done automatically and ... it is possible ....

In Eclipse / SpringSource Tool Suite:
  1. What you need to do is decleare your variable
  2.  Press  Alt + Shift + S and choose "Generate Getters and Setters
and implementation is done for you :).

It means i found second reason to like Eclipse : (first one was quickfix) .