i've committed a change in the default mapping for lists. please build
from the latest code. i've updated the website with some documentation
but it'll take a while to sync and you may be better looking at the unit
tests. see src/test/org/apache/commons/betwixt/poly/TestPolyList.java.
- robert
On Wed, 2006-05-17 at 22:21 +0100, robert burrell donkin wrote:
> On Thu, 2006-05-11 at 14:22 +0200, Holger Haag wrote:
> > Hi all,
> >
> > I'm trying to figure out how (or if) it is possible to handle lists
> > containing instances of an interface.
> >
> > Sample:
> >
> > // the interface
> > public interface MyInterface {
> > ..
> > }
> >
> > // an implementation
> > public class MyImpl1 implements MyInterface {
> > ..
> > }
> >
> > // an implementation
> > public class MyImpl2 implements MyInterface {
> > ..
> > }
> >
> > // the list containing instances of MyInterface
> > public class MyList extends java.util.List<MyInterface> {
> > ..
> > }
> >
> >
> > A serialized sample should look like the following
> >
> > <list>
> > <!-- serialized instance of MyImpl1 -->
> > <impl1>
> > </impl1>
> >
> > <!-- serialized instance of MyImpl2 -->
> > <impl2>
> > </impl2>
> >
> > <!-- serialized instance of MyImpl1 -->
> > <impl1>
> > </impl1>
> > </list>
> >
> >
> > I think this is currently not possible via betwixt (pls. correct me if I am
> > wrong)
> > since all list items will be named "myinterface" or so thus loosing the
> > proper type information.
>
> <snip>
>
> > So the question boils down to how to setup polymorphic mapping for generic
> > lists.
> > http://jakarta.apache.org/commons/betwixt/guide/reading.html only details
> > how to do this for a container, but nothing about lists/collections.
>
> there are two parts to this problem: the first is configuring
> polymorphic mappings so that the reading works. the second is persuading
> betwixt to write the right names. it's easiest to attack them
> separately.
>
> the documentation should give a reasonable description about how to
> setup the multi mapping so that the reading works.
>
> the second problem is covered in
> http://jakarta.apache.org/commons/betwixt/guide/derived.html. you may
> need to switch mapping derivation to introspection time.
>
> the only wrinkle is that it might be difficult to configure a list
> (rather than a container). i'm not ATM whether this will be a problem or
> not. i'll try to find time tomorrow to try this out.
>
> - robert
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]