On Saturday 06 November 2004 07:21, 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.
>
> I also want to be able to easily get the refered Object from the KeyRef
> and Key Object from the refered Object. That way the application doesn't
> have to maintain any hashmaps for such traversal.
>
> Something like
>
> Order o = (Order) orderKeyRef.getReferedObject();
>
> and
>
> OrderKeyRef okr = (OrderKeyRef) order.getKeyRef();
>
> I am not sure how difficult it is to implement this.  Any thoughts on
> this ?

This is a very good idea. Keyref would seriously simplify access to elements. 
I'm too finding myself walking through enumerations constantly. I'm willing 
to help testing and discussing the implementation.

You probably want to generate code for a Map with keys in the element 
containing the key element. In addition you need to create a class for the 
key and create one from the information in the referenced element when 
unmarshalling it and when adding a new referenced object to the element. (As 
far as I can see, you don't need to do any code for marshalling.) And then 
you'll want to add the convenience functions you mentioned above. All in all 
not trivial, but doable. Handling complex keys is a bit difficult I guess.

The most difficult thing is to keep all the references valid. What if the name 
is the keyref and the function 'setName' is called on an object? Do you then 
change the key in the map too? And what about the key referencing the object 
from another element? It's up to the user to keep that consistent, I guess. 
You could add a boolean to update all references, but that means quite a bit 
of extra complication.

Cheers,
Jos van den Oever



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

Reply via email to