incubator-kato-spec mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Poole <spoole...@googlemail.com>
Subject Re: JavaObject.getHashcode(), JavaObject.getPersistentHashCode()
Date Thu, 23 Jul 2009 12:04:49 GMT
+1

On Thu, Jul 23, 2009 at 11:22 AM, Stuart Monteith <stukato@stoo.me.uk>wrote:

> Hi,
>   I've just been reviewing the Java documentation for
> JavaObject.getHashcode(), JavaObject.getPersistentHashCode().
> I am thinking they should be replaced by:
>
>   JavaObject.getHashcode();
>   JavaObject.isHashcodePersistent();
>
> Where the first method will calculate a hashcode and return it if the
> object's hashcode is not persistent, and will returned the stored hashcode
> if it is persistent.
> The second method returns true if the hashcode is persistent.
> I'm thinking this avoids us doing:
>
>   long hashcode;
>   boolean persistent;
>   try{
>         hashcode = obj.getPersistentHashcode();
>         persistent = true;
>   }catch (DataUnavalable e) {
>      hashcode = obj.getHashcode();
>      persistent = false;
>   }
>
> we could instead do:
>
>   long hashcode = obj.getHashcode();
>   boolean persistent = obj.isHashcodePersistent();
>
> the only reason that occurs to me to not do it this way is if it is in
> someway important to be able to get both hashcodes.
>
> Thoughts?
>
>   Stuart
>
> --
> Stuart Monteith
> http://blog.stoo.me.uk/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message