You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by LOX <di...@blue-edge.bg> on 2003/06/19 16:49:38 UTC

[betwixt] how to write a collection of heterogenous objects

Hi all,

Currently I have a class which holds a hierarchy of composite beans.
There are two kinds of  beans LeafBean and BranchBean. Both of them 
inherit from NodeBean.
The BranchBean holds some data and a collection of NodeBeans. The 
LeafBean contains only primitive data.

When I write the structure using BeanWriter, Betwixt writes all the 
beans as "node", since this is the name of the property of the 
BranchBean. The problem is that when I try to read the resulting XML, 
the BeanReader cannot determine unambiguosly which node corresponds to 
what object.

What I imagine is to have Betwixt write different tags for the different 
kinds of objects in the collection, but it seems impossible so far.

Any ideas?

Regards,
Dimiter


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] how to write a collection of heterogenous objects

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
i think that this is a limitation of betwixt at the moment. quite frankly 
it's unlikely that i'll be able to find the time to code this any time 
soon but i'd be glad to work with you if you want to try to contribution 
some solutions.

- robert

On Thursday, June 19, 2003, at 03:49 PM, LOX wrote:

> Hi all,
>
> Currently I have a class which holds a hierarchy of composite beans.
> There are two kinds of  beans LeafBean and BranchBean. Both of them 
> inherit from NodeBean.
> The BranchBean holds some data and a collection of NodeBeans. The 
> LeafBean contains only primitive data.
>
> When I write the structure using BeanWriter, Betwixt writes all the beans 
> as "node", since this is the name of the property of the BranchBean. The 
> problem is that when I try to read the resulting XML, the BeanReader 
> cannot determine unambiguosly which node corresponds to what object.
>
> What I imagine is to have Betwixt write different tags for the different 
> kinds of objects in the collection, but it seems impossible so far.
>
> Any ideas?
>
> Regards,
> Dimiter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org