ariba.util.core
Class ObjectUtil

java.lang.Object
  extended by ariba.util.core.ObjectUtil

public class ObjectUtil
extends java.lang.Object

This is a class of static methods useful for Objects in general. Currently it has helper methods that help in building equals and hashCode methods for Objects.


Constructor Summary
ObjectUtil()
           
 
Method Summary
static boolean equalsObj(java.lang.Object obj1, java.lang.Object obj2)
          Returns true if the two objects are both null, or both the same instance, or if they are both non-null and their equals method returns true.
static int hashCodeNext(int hashCode, boolean value)
          Returns int hash code based on the previous hash code combined with the given boolean value, using int 1 for true and 0 for false.
static int hashCodeNext(int hashCode, int value)
          Returns int hash code based on the previous hash code combined with the given int value, following the algorithm outlined in Sun's Javadoc for java.util.List hashCode.
static int hashCodeNext(int hashCode, long value)
          Returns int hash code based on the previous hash code combined with the given long value, splitting the long value into two int values and doing the little-endian int first, and the big-endian int second.
static int hashCodeNext(int hashCode, java.lang.Object obj)
          Returns int hash code based on the previous hash code combined with the hashcode for the given Object, or 0 if the Object is null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectUtil

public ObjectUtil()
Method Detail

equalsObj

public static boolean equalsObj(java.lang.Object obj1,
                                java.lang.Object obj2)
Returns true if the two objects are both null, or both the same instance, or if they are both non-null and their equals method returns true. This method is helpful when building an equals method for an object, based on equality of its fields, where the fields may be null.


hashCodeNext

public static int hashCodeNext(int hashCode,
                               int value)
Returns int hash code based on the previous hash code combined with the given int value, following the algorithm outlined in Sun's Javadoc for java.util.List hashCode. By convention, the initial value of hashCode should be 1, and the values corresponding to significant fields of the class should be combined in a canonical order, because order matters to this algorithm. This method is helpful when building a hashCode method for an object, based on combining int values corresponding to its fields.


hashCodeNext

public static int hashCodeNext(int hashCode,
                               long value)
Returns int hash code based on the previous hash code combined with the given long value, splitting the long value into two int values and doing the little-endian int first, and the big-endian int second.


hashCodeNext

public static int hashCodeNext(int hashCode,
                               boolean value)
Returns int hash code based on the previous hash code combined with the given boolean value, using int 1 for true and 0 for false.


hashCodeNext

public static int hashCodeNext(int hashCode,
                               java.lang.Object obj)
Returns int hash code based on the previous hash code combined with the hashcode for the given Object, or 0 if the Object is null. This method is helpful when building a hashCode method for an object, based on combining int values corresponding to its Object fields, where the fields may be null.



AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.