Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

generate get set methods using eclipse

 
Hemu Koru
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have eclipse installed on my machine, how do i generate get, set methods automatically for a class/interface, just by giving the names of the methods, their return types, and arguments. I have about 50 fields in mysql database and I want to generate a class matching the fields of the mysql database. It takes me hours to code this class manually.

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hemu,
Just using Eclipse, you can create a class with the fields. For example,


Then, go to the outline pane. Right click and select "generate getters and setters." Then pick select all and Eclipse will do the rest of the work.

You might also want to look into an O/R (object/relational) mapping tool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic