commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [betwixt] plugging in code for specific fields
Date Thu, 03 Mar 2005 23:01:44 GMT
On Tue, 2005-03-01 at 03:24, wrote:
> Hello


> I wish to use betwixt to dump and load objects from instances of
> application over which we have no control of the api. I can get it to work
> for simple cases but I am unsure of the approach to take to customise it's
> behaviour in the following circumstance:

i'm not sure that there's an out-of-the-box solution (maybe it would be
a good idea to have a pluggable substitutor) but i think that you should
be able to do it with a little effort and ingenuity...

> 1) when I'm dumping out a bean to xml which includes a field which is an id
> of another object , I wish to be able to plug in some code that does a
> lookup of the referenced object so that I can write out the key instead of
> the id, 

one approach to this would be to use a betwixt file (or any other
suitable method) to ensure that the element name is appropriate and then
use a custom ObjectStringConverter to look up the key. you'll probably
want to upgrade to a recent nightly or roll your own from CVS to take
advantage of the methods that take contexts.

> and
> 2) when I reading in that xml I wish to be able to plug in code that does a
> look up with the key to recover the id.

you might be able to use the same mechanism to look up the id in this
way as well.

there are a few other ways this might be done but this seems to me the

- robert

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

View raw message