I think this is the best thing we can do here.
Andrus
> I modified nullSafeEquals to look like:
>
> public static boolean nullSafeEquals(Object obj1, Object obj2)
> {
> if (obj1 == null && obj2 == null)
> return true;
> else if (obj1 != null)
> {
> // Arrays must be handled differently, since equals() does
> // an == and ignores equivalence
> if (obj1.getClass().isArray() == false) {
> return obj1.equals(obj2);
> }
> else { // It is an array, so compare the contents
> EqualsBuilder builder = new EqualsBuilder();
> builder.append(obj1, obj2);
> return builder.isEquals();
> }
> }
> else
> return false;
> }
>
>
> Any thoughts on this? It is currently working in my test application
> (no more redundant UPDATEs). I tried to put the common case (non-binary
> byte arrays) first and only do my stuff last ...
>
> Thanks,
>
> /dev/mrg
>
>
>
> -----Original Message-----
> From: Cris Daniluk [mailto:cris.danilu..mail.com]
> Sent: Wednesday, May 25, 2005 3:32 PM
> To: cayenne-deve..bjectstyle.org
> Subject: Re: ObjectStore help ...
>
>
>> I guess we need to change Util.nullSafeEquals() to make it similar to
>> ObjectId.equals that does "deep" comparison of primitive arrays. The
>> question is how to do it without too much overhead as "nullSafeEquals"
> is
>> used all over the place.
>>
>> Andrus
>>
> nullSafeEquals is used all over the place, but in general, primitive
> arrays are not. Shouldn't be a big impact, should it?
>
> Cris
This archive was generated by hypermail 2.0.0 : Wed May 25 2005 - 16:45:16 EDT