This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create bean with Init method

 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is there any plugin or tool for create POJO or bean with init() method ?
Not just POJO with getter, setter method. I need init method with default values.

Thanks
Kathiresan
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would the plugin know what the default values are?

Are you talking an IDE plugin, or a Spring plugin?
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Can't you create a default constructor that sets default values?

Sean
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

I need to call like following in init() method

bean.setAddress1("");
bean.setAddress2("");
bean.setCity("");
bean.setState("");
bean.setZip("");

Also I have to create class which implements ParameterizedRowMapper
But I have around 50 columns to map like

car.setAddress1(rs.getString("ADDRESS1"));
car.setAddress2(rs.getString("ADDRESS2"));
car.setCity(rs.getString("CITY"));
car.setState(rs.getString("STATE"));

So am looking any external tool or eclipse plugin for generate this.

Thanks in advance
Kathiresan
 
Hong Anderson
Ranch Hand
Posts: 1936
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kathiresan Chinna wrote:
car.setAddress1(rs.getString("ADDRESS1"));
car.setAddress2(rs.getString("ADDRESS2"));
car.setCity(rs.getString("CITY"));
car.setState(rs.getString("STATE"));

I suggest to use a Data Mapper Framework like iBATIS.

Regarding code generation, you should try Code templates feature.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic