commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Betwixt]: Writing polymorphic beans
Date Thu, 03 Jan 2008 08:09:42 GMT
Env: JDK1.6, Betwixt 0.8

I have a bean A which contains a polymorphic reference to a bean B or C via
an interface as follows:

    class A {
         private IVehicle vehicle;
         public IVehicle getVehicle() { ... }
         public void setVehicle(final IVehicle v) { ... }

    class Car implements IVehicle { ... }
    class Bus implements IVehicle { ... }

I need to write an instance of A out as follows:


or as 

If I use a betwixt file as follows:

      <info primitiveTypes="attribute">
            <element name="A">

I get <A><model>...</model></A>

which is clearly wrong. How can I use the PolymorphicReferenceResolver  to identify
if <car> or <bus> must be emitted?

Can you point me to a sample?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message