[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ozone object identity...



On Fri, 27 Apr 2001, Ola Berg wrote:
> > Also, David, what do you want to return from a 
> > getObjectIdentity() method? The
> > internal object ID? This would make client code depend on 
> > the internal
> > implementation! (the current 64bit number is one solution 
> > maybe we have to
> > change this for some reasons in the future)
> 

> How about returning Object? And the contract should only state that its
this.equals( anotherId) method should return true iff the anotherId is an ID to
the same underlying object as "this"? > 

> Then it would be implementation independent. I have used that pattern for
> the identity of permissions in a system of mine. I don't specify what a
> permission is, only that equals() should work in this manner (as well as
> hashCode() ). > 

Hmmm... sounds good! Instead of having methods like indentityHashCode() and
identityEquals() we then write object.identity().hashCode().

identity() returns Object, which already defines the contract we need -
hashCode() and equals().

Plus an objectByIdentity(Object) method. I like this! ;)


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com