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] Options for doing a roundtrip
Date Sun, 01 Feb 2004 23:19:47 GMT
On 30 Jan 2004, at 09:21, Cheong Chung Onn wrote:

> Hi all,
>
> I am using Betwixt to do object persistence, I am facing some 
> challenges using it. Essentially,  I have to "open up" my class 
> Interface in order to achieve the desire behavior from Betwixt? I 
> would appreciate any one could direct me to the  right way to this 
> problem. Below is my scenario
>
>  I have a class Person which has an attribute "address" type 
> AddressIntf. The implementation of AddressIntf is Address.  Address 
> has both the getters and setters of all its attributes, but 
> AddressIntf only has the getters. When i map the object to xml using 
> Person instance, i got the expected output.  However when i try to map 
> it back to a Person instance,  i only have an uninitialized address 
> instance. Note I've a custom class creator  to create an instance of 
> Address.  In order to achieve the desire result i.e. the address 
> instance attributes being updated, i would have to "open-up" the 
> AddressIntf  by adding the setter methods. Is there any way around 
> this problem?

betwixt is start-from-java and concentrates on java beans so most of 
the methods are geared around object models composed of java beans. so, 
it's more difficult to map objects which are not java beans. adding 
support for designs which are not typical use cases for object models 
composed of java bean is not a priority for me. (of course, if some 
developers wanted to step up who were more interested in adding these 
features then i'd be willing to give help and directions.)

one possibility which others have found useful in the past is to create 
and register (in the XMLIntrospector.getRegistry) custom XMLBeanInfo's 
which contain a custom updater (MapEntryAdder is an example of this 
kind of updater).

- 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