Hi all,
I am using the SourceGenerator from the cvs version of castor.
Some of the classes have unmarshall methods, but with different names. For instance, if my root element in my xml is "myRoot", the unmarshall method for the generated class is the static method "unmarshallmyRoot". This is very usefull under some circumstances, but I wish to be able to treat all castor generated classes the same way. Of course I can always run the static Unmarshaller.unmarshall method.
What I really want is a non-static method that all SourceGenerator generated classes implement, ideally with the same name, ie "unmarshall" which unmarshalls the xml into the current object. For instance, I would like to be able to do this:
 
myCastorObj obj = new myCastorObj(); # empty except for root element
myInterface interface = (myInterface )obj; # cast to my castor object interface
interface.loadFromXML(xmlString);# unmarshall from xml into current object
interface.myMethod(); # run a method not available until unmarshalling has been completed.
 
I understand that I can achieve this functionality in other ways, but the point is that I wish to reuse these objects (cache them for later use) and unmarshall them again in the future. Does anybody have any experience with this? Any ideas much appreciated.
kipz.
 
 

Reply via email to