commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [betwixt/digester] mapping interfaces to classes
Date Wed, 20 Aug 2003 21:17:21 GMT

On Tuesday, August 19, 2003, at 11:47 PM, Gary S. Cuozzo wrote:

>> (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.  :-)

so much to do, so little time.

>> 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.

oops - i forgot this option. this is adding an extra attribute to the 
.betwixt file that specifies an implementation class - probably a 'class' 
attribute. (this isn't the same as derived beans.)

this should be pretty easy to implement but it's probably not worth 
contributing to right now since it means changes in the code i've just 
moved. i might take a look at this once i've committed the changes i'm 
working on (see below).

how does the name 'class' sound for the betwixt attribute name?

>> 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
> beanreader?

i've now completed the code and the testing of the refactored reading code.
  i still need to review the package structure and naming, complete the 
documentation and write some tests to check that the custom hooks work 
correctly. i hope to have this finished within the next 24 hours.

>> 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.

i think i've probably confused you. this is probably easier to explain 
once i've committed the code i've been working on.

>> 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.

thanks for the feedback. one of the problems with betwixt is that it's 
poorly structured and difficult to work on unless you spend a lot of time 
looking at the code. hopefully, it's become better factored but it's a 
long process.

> 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.

cool. i hope to post something a little later.

- robert


Mime
View raw message