Just for information:
I recently had a problem when I decided to explicitly specify the set-method
for a collection with e.g.
<field name="Things" type="Thing" collection="set" set-method="addThing">
...
</field>
and this broke the marshalling completely: as soon as a field with such a
mapping was encountered, none of its "children" would be marshalled. The
problem seems to be that, where previously the set and get methods were
auto-detected as set/getThings(...), once the set-method is explicitly defined
the default get-method is no longer used. I had to change the mapping to
<field name="Things" type="Thing" collection="set" set-method="addThing"
get-method="getThings">
to make it work. I didn't see any mention of this in the documentation and it
was a bit confusing: maybe something should be added to the docs to say that if
set-method is specified then get-method *must* be specified, too? Or is this
actually a bug? It was certainly a surprise for me.
Cheers,
Andy
PS. Actually, I found the whole issue of the collection mapping attributes
pretty confusing: it would (I think) make things much simpler if collections
could also use an "add-method" attribute. But maybe there's a reason why that
wouldn't work. I did try refactoring the Castor code that handles this a while
back, and it was only through that (after some digging) that I worked out that
"set-method" could be set to an "add-type" method for collections - the code is
pretty convoluted!
--
Andy Buckley: CEDAR @ IPPP, Durham
Work: www.cedar.ac.uk
www.insectnation.org
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email