You specify a factory method for creating each player that takes an Object
parameter which you then cast to type Club.

See the description for the "factory"
attribute<http://jibx.sourceforge.net/binding/binding-attributes.html#object>for
details.

-Archie

On Tue, Sep 21, 2010 at 6:08 AM, Miguel <mig...@almeida.at> wrote:

>  Hi,
>
> My issue is best described with an example. The question is: in the
> following code, how can I replace HOWTOGETTOPARENTOBJECT? in the binding so
> that I get parentBindingField.name, knowing that Player doesn't have a Team
> field:
>
> <club>
>   <name> Liverpool </name>
>
>   <squad>
>     <player>
>       <team>Liverpool</team>
>       <name>Joe Cole</name>
>     </player>
>     <player>....</player>
>   </squad>
> </club>
>
>
> Java:
> Club{
> String name;
> List players
> }
>
> Player{
> String playerName;
> }
>
>
> Jibx binding:
> <binding>
> <mapping class="Team">
> <collection name="squad" usage="optional" field="players"
> create-type="java.util.ArrayList">
> <value name="squad" field="HOWTOGETTOPARENTOBJECT? I want team.namehere!"/>
> <value name="name" field="name"/>
> </collection>
> </mapping>
> </binding>
>
> Thank you in advance,
>
> Miguel Almeida
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>


-- 
Archie L. Cobbs
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to