Why do we need a no argument constructor in a JavaBean component?

John Zukowski

The proper way to create JavaBean components is through the Beans.instantiate() method. Beans.instantiate() loads the class and creates the Class object. Then it instantiates an instance of that class. If you've already saved a serialized bean prototype, the prototype is used and the no argument constructor is not called. There is nothing in the JavaBeans specification that says a JavaBean component must have a no argument constructor. If, however, you haven't saved a serialized version of the bean (which is usually the case), then the no arugment version of the constructor is called. This is when it is needed...

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact