• Post Reply Bookmark Topic Watch Topic
  • New Topic

generating JavaBean code  RSS feed

 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the best way to automatically generate JavaBean code (getters and setters)? Is it X-Doclet? or some other technology? It would be nice to generate from a simple list of the field names.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an ORM question. Moving...
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using an IDE? Does your IDE have functionality to automatically generate getter and setter methods?

I use Eclipse. I can type in something like this:

Then I choose the menu Source / Generate Getters and Setters and there I can specify a number of options to generate getter and setter methods for the fields.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper, thanks so much. Wow!! Yet another reason to use eclipse! I suppose I should look into its ability to create database schemas as well.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!