users@jaxb.java.net

Re: JAXB and equals

From: Mark Brouwer <mark.brouwer_at_VIRGIL.NL>
Date: Wed, 09 Apr 2003 03:58:08 -0600

On Tue, 28 Jan 2003 11:28:08 +0100, =?iso-8859-1?Q?Mattias_R=F6nnblom?= <mattias.ronnblom_at_ericsson.com> wrote:

>Hi,
>
>I asked jaxb-comments why the equals() method only has the default
>implementation (in Object, only object equality), and not, which
>I would have expected, an implementation comparing each attribute
>using equals() down the object graph.
>
>I got the answer that it's hard to implement, and that there were
>some performance issues. The thread on this list with the subject
>"hashCode" seems to end with the same answer.
>

This topic has been discussed here a while ago, but I too would like
to state this is a feature one needs.

I run into situation where I have to replace a part of a JAXB
object model with some new data. In case this data equals to the
part I'm replacing I don't want to. The actual replacing would
trigger some non trivial code working on the JAXB model,
something I would like to prevent.

>
>After all, what's being generated is Data Transfer Objects (aka Value
>Objects), and (god forgive) have no behaviour, then a equals()
>with value-based semantics would be what most people expects.
>

Currently I have to implement my own equality logic and I agree with
the original poster that this is a feature one may expect (in time).
Consider this a feature request for the next JAXB specification.
--
Mark Brouwer