commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [betwixt] Only use idref for == objects, not for equal objects
Date Sat, 22 Oct 2005 14:53:12 GMT
On Mon, 2005-10-17 at 10:12 +0200, Wim Deblauwe wrote:
> Hi,
> Betwixt outputs idref attributes for objects that are equal. It would be
> better if it only used idref for objects that are the same reference (==).
> Because when you use Betwixt now to serialize 2 equal objects, they turn
> into the same object after deserialization. So you have a different
> situation.

betwixt is a bean mapping (not an xml serializer). using equals is
therefore a reasonable default. 

> This problem can easily be solved by replacing the use of HashMap in
> AbstractBeanWriter with IdentityHashMap.

since the 0.7 release, this has been factored out into IdStoringStrategy
but as wim rightly says, using an implementation which is backed by
IdentityHashMap will give the behaviour required. i've added a
convenience constructor to DefaultIdStoringStrategy to make this a
little easier.

- robert

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

View raw message