[ 
http://jira.codehaus.org/browse/JIBX-235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Sosnoski updated JIBX-235:
---------------------------------

    Component/s: core
       Assignee: Dennis Sosnoski

This is somewhat ugly, but cleaning it up in the current code generation is 
probably impractical. It'll be addressed for 2.0.

> 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
>          Components: core
>    Affects Versions: JiBX 1.1.6
>            Reporter: Petter Måhlén
>            Assignee: Dennis Sosnoski
>
> 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

       

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to