Using JavaBeans for simple data objects
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aron_Murray
Posted On:   Wednesday, September 18, 2002 07:23 PM

Is it worth converting some simple data objects to JavaBeans just to use java.beans.XMLEncoder for serializtion?


Will this add much overhead? Is there any alternatives to java.beans.XMLEncoder ?

Re: Using JavaBeans for simple data objects

Posted By:   Aron_Murray  
Posted On:   Saturday, September 21, 2002 09:58 PM

Ok since nobody answered I have trolled lots of java bean related articals, tutorials and FAQs. To finally find the answer in this sun artical by Philip Milne. Where he states.



If a class has a no-argument constructor and all of its state is exposed in its properties, each of which is independent of the others, ... the default persistence delegate [used by XMLEncoder] will be able to write out all of the state in your object automatically.



So the answer seems to be that it is worth converting them to java beans because for most simple objects its a trivial exercise.

Re: Using JavaBeans for simple data objects

Posted By:   Aron_Murray  
Posted On:   Saturday, September 21, 2002 02:56 AM

Just to clarify some points I java.beans.XMLEncoder seems to be the only way to serialize objects and use them between VM's. Hence my question on converting some objects to be full beans.



Are there any other ways to get this functionality?

About | Sitemap | Contact