commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary S. Cuozzo" <>
Subject Re: [betwixt/digester] mapping interfaces to classes
Date Tue, 19 Aug 2003 22:47:25 GMT
> (my apologies that took me a while to answer, i haven't been a bit ill.)
sorry to hear you have been ill.  i sure do appreciate the reply.  was
beginning to think nobody ran across this before, but saw "better
support for interfaces" on the todo list.  :-)

> use derived beans
> -----------------
> this means using an attribute of the xml to specify the class to be 
> created. this need a little work (there is no setting to switch on writing 
> these attributes, there is no beaninfo attribute to customize the 
> attribute name and reading only sets the properties that the interface 
> expresses). i might be persuaded to bring forward adding writing - or you 
> could probably have a go at adding this functionality yourself (its pretty 
> easy). if you do, then maybe you'd care to submit a patch :)
this is probably what i was trying to do with .betwixt files (but
couldn't get it to work).  basically tell betwixt "when you see
AuthInfo, instantiate GenericAuthInfo" or something like that.

if you give me some clues as to where to start, i would be open to do
this.  i've got 2 options right now:  create a complete hack of my code
where i duplicate a class and change the methods to work with betwixt
(yuk) or make betwixt do what i want.  i'd rather spend my time
producing something useful to others.

> custom bean creator
> -------------------
> this is what i've been looking at today. betwixt's bean reading will be 
> refactored to use a chain of bean creators rather than a monolithic method.
>   this will allow users to plug their own bean creators to create (say) 
> implementations for their interfaces. i like this approach since it's 
> powerful, elegant and flexible. if you like the sound of this then it'll 
> probably be worth waiting around a few days until it's finished.
if this will be available in a few days, then i'm game.  sounds like a
nice flexible solution.  for my app, being able to control it on the
reading end will allow me to plug-in any implementation that i want. 
keep me posted on development and i'll help test it.  is this something
that would work via .betwixt files?  or runtime config of the

> strategy interface for creating typed objects
> ---------------------------------------------
> the ideas is that a hook would be provided to allow a creater to be 
> registered for a particular type of object. unfortunately, i want to 
> implement this as a bean creator so this is a way down the track.
i wonder if i follow this correctly...  would the creator be on the side
that writes the XML?  if so, then that would not be as flexible since it
would force me to make a decision on the actual implementation to use
before i actually know what it is.  my guess is that i'm
misunderstanding what this actually means.

> please let me know how this sounds.
i like the sound of the first & second solutions.  i'm happy to try and
help though i'm totally new to betwixt/digester and will have a bit of
ramp-up time.

let me know which solution you are leaning toward.  point me in the
right direction and i'll lend a hand, even if it is just testing.

thank you for the reply.  a solution to this is currently holding up my
project.  i had started researching other options before creating a
(temporary) hack to my project.


> - robert
> On Sunday, August 17, 2003, at 05:26 AM, Gary S. Cuozzo wrote:
> > I've been struggling with betwixt and trying to get it work with classes
> > that make use of methods that accept/return interfaces.  Is there any
> > way to tell betwixt (or the underlying digester) when it sees an
> > interface in the xml data that it should actually create an instance of
> > some specific class that implements the interface?  or, i suppose the
> > alternative would be have the xml get generated with the class name as
> > opposed to the interface name.
> >
> > Any help is appreciated,
> > gary.
> > --
> > Gary S. Cuozzo <>
> > Innovation Software Group, LLC
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Gary S. Cuozzo <>
Innovation Software Group, LLC

View raw message