• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Create bean with Init method

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

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

Sean
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I don't even know how to spell CIA. But this tiny ad does:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic