incubator-kato-spec mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Monteith <stuk...@stoo.me.uk>
Subject JavaObject.getHashcode(), JavaObject.getPersistentHashCode()
Date Thu, 23 Jul 2009 10:22:20 GMT
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
View raw message