The <format> only works with the static type information known to the binding compiler, unlike <mapping> which is dynamically typed at runtime. To get the <value> to use the format you need to tell the binding compiler that the items in the collection are of the type associated with the format. You should be able to do this by using <value name="rq" type="gr.talent.cruiser.dataManager.fetch.queue.RTDRequest"/>. You could also just specify the serializer/deserializer directly on the <value> element without using a separate <format>, as <value name="rq" serializer="gr.talent.cruiser.dataManager.fetch.queue.JiBXHelper.marshallRTDRequest" deserializer="...unmarshallRTDRequest"/>

Using the item-type attribute of the <collection> *won't* work, though I can see where you'd think it would. The documentation says this has to be the name of a class with a defined <mapping>. If that's not being checked now it should be to let users know when they've got a problem.

 - Dennis

???e??? ?a???t?a??? wrote:

Hi guys,

I've an ArrayList which contains instances of a class RTDRequest. For
various reasons, I've defined
a custom marshaller/unmarshaller for this class.

I thought I'd use a <collection> in the binding, and define a <format>
element to set the serializer/deserializer for
the class type, thinking that JiBX would see the class type in the
collection and look for the appropriate de/serializer.

But that didn't happen, at best all I got was an RTDRequest.toString() :(
Does anyone have any ideas ?

I've tried both:

<collection field="rtd_reqs">
           <value name="rq"/>
       </collection>

and:

<collection field="actionDescriptors"
item-type="gr.talent.cruiser.dataManager.fetch.queue.RTDRequest" />

and my <format> tag is:

<format type="gr.talent.cruiser.dataManager.fetch.queue.RTDRequest"

serializer="gr.talent.cruiser.dataManager.fetch.queue.JiBXHelper.marshallRTD
Request"

deserializer="gr.talent.cruiser.dataManager.fetch.queue.JiBXHelper.unmarshal
lRTDRequest"/>



Cheers, Angel



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to