I am working on a new Android
project (Java
), and created an Object with a large number of variables. Since I am planning to add getters and setters for all of them, I was wondering: is there a shortcut in Eclipse
for automatically generating the getters and setters in a given class?
Bring up the context menu (i.e. right click) in the source code window of the desired class. Then select the Source
submenu; from that menu selecting Generate Getters and Setters...
will cause a wizard window to appear.
Source -> Generate Getters and Setters...
Select the variables you wish to create getters and setters for and click OK
.