commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary S. Cuozzo" <>
Subject Re: [betwixt] Mapping for interface instead of class
Date Wed, 27 Aug 2003 14:07:30 GMT
well, i am creating beans from the xml and it works for my case.  you
are right that you do have to choose what implementation class you want
to use for the beans and that is what you put in the .betwixt file.

in my case, i generate the xml from a class that has a collection of
AuthInfo interfaces.  then, when reading, i choose to have the authInfo
tag cause instances of GenericAuthInfo beans (which implement AuthInfo).

for my application, i actually don't care what the original
implementation was, i only need a bean that has similar data.


On Wed, 2003-08-27 at 09:58, Martin van den Bemt wrote:
> Creating beans from that will however still not work. 
> If you have Interface I and class A and B implementing I, betwixt cannot
> figure out which class it was, unless we are actually putting the
> getClass().getName() into the xml now (please forgive me not looking at
> the code to check this), for the objects the be correctly recreated from
> xml..
> Mvgr,
> Martin
> > > 
> > > Please keep in mind that betwixt cannot recreate the beans if they are
> > > based on an interface. (new Interface() just doesn't work :) ). 
> > 
> > this is exactly what robert fixed/implemented last week.  check the
> > betwixt page and look at advanced reading.  there is now a 'class'
> > attribute in the <element> in the .betwixt file.  i just tried it last
> > night and it works fine.  makes it so that you can map an interface at
> > read-time to a concrete class that implements it.
> > 
> > cheers,
> > gary.
Gary S. Cuozzo <>
Innovation Software Group, LLC

View raw message