Inconsistency when using pre-set and post-set methods with Object argument
--------------------------------------------------------------------------
Key: JIBX-235
URL: http://jira.codehaus.org/browse/JIBX-235
Project: JiBX
Issue Type: Bug
Affects Versions: JiBX 1.1.6
Reporter: Petter Måhlén
In an example like this:
binding: -----
<mapping class="parent">
<structure name="name1" field="field1" type="type1" post-set="postset" />
<structure name="name2" field="field2" type="type2" />
<collection name="collection" field="field3" item-type="type3" />
</mapping>
<mapping class="type1" abstract="true">
</mapping>
<mapping class="type2" post-set="postset" abstract="true">
</mapping>
<mapping class="type3" post-set="postset" name="name3">
</mapping>
----
XML: ---
<parent>
<name1 />
<name2 />
<collection>
<name3/>
</collection>
</parent>
---
The postset(Object) method of the class type1 will be called as expected, with
the Object parameter indicating the "parent" node. However, for type2, the
"name2" node will be passed in. For type3, the Object parameter will be
pointing to the Collection instance representing the "collection" node, which I
find to be logical.
I have seen two workarounds:
1. Always specify the 'post-set' method on the 'structure' level rather than on
the abstract mapping level. That is a bit brittle in my case and doesn't solve
the problem (easy to forget it on one structure).
2. For the 'type2' case, specify a post-set method that takes the
IUnmarshallingContext parameter and go one step deeper in the hierarchy to find
the correct containing object. This works, but means that I need to treat cases
1 and 3 one way, and 2 in another.
Suggested solution: make case 2 work like case 1. :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs