Saravanan Subbiah wrote:


Can you please let me know where to start looking to implementing
this? I can give it a shot if I get some time.

UnmarshalHandler and IDResolver are the two primary places that would require changes.


Thanks ! I will look into this sometime. I feel that if equals method is
generated for KeyRef Class, then comparision shouldn't be very different
for KEYREF from IDREF.



If you experiment with ID and IDRef you'll see that the Castor UnmarshalHandler adds the actual object reference for IDREF. When you marshal, the ID is obtained you only get the IDREF in the XML, but during Unmarshalling Castor finds the object references and puts that
in the actual IDRef field. So basically this is the way it already
works.


I tried it and it works just as you explained which makes it more usable. Though One problem with ID and IDREF approach is that when
working with a huge project with a lot of referencing, to make the ID
unique globally, I want to have separate attribute called ID for all
elements that will be referenced.


I don't want to set it everytime I create one of these objects. I want
the constructor of the object to call some Factory Class to generate its
own unique ID. Then the application needs not even worry about setting
these IDs explicitly.

Can the source generator be made to generate these calls automatically ?

Saravanan,

The SourceGenerator won't generate these calls, but it will extend a single base class. I usually add this type of functionality to a BaseObject (along with toString() and any other utility methods that all the generated classes need) and make every class extend that BaseObject using the org.exolab.castor.builder.superclass property in the castorbuilder.properties file.

Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'


The Castor Project
http://www.castor.org/

Apache Geronimo
http://geronimo.apache.org/



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to