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] plugging in code for specific fields
Date Thu, 03 Mar 2005 23:01:44 GMT
On Tue, 2005-03-01 at 03:24, Stephen_Newman@bnz.co.nz wrote:
> Hello

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

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message