com.tensegrity.generic.util
Class Comparison

java.lang.Object
  extended bycom.tensegrity.generic.util.Comparison

public class Comparison
extends java.lang.Object

The class Comparison contains methods used to compare java objects in a safe way, meaning that values are checked against null.

Author:
BurkhardWick

Constructor Summary
Comparison()
           
 
Method Summary
static boolean safeEquals(java.lang.Object obj1, java.lang.Object obj2)
          Checks if the two given objects are equal, includes a check for null values
static boolean safeEqualsIgnoreCase(java.lang.String str1, java.lang.String str2)
          Checks if the two given strings are equal (ignoring case), includes a check for null values
static int safeHashCode(java.lang.Object obj)
          Returns the hashcode of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Comparison

public Comparison()
Method Detail

safeEquals

public static final boolean safeEquals(java.lang.Object obj1,
                                       java.lang.Object obj2)
Checks if the two given objects are equal, includes a check for null values

Parameters:
obj1 - The first object
obj2 - The second object
Returns:
True, if the two objects are equal

safeEqualsIgnoreCase

public static final boolean safeEqualsIgnoreCase(java.lang.String str1,
                                                 java.lang.String str2)
Checks if the two given strings are equal (ignoring case), includes a check for null values

Parameters:
str1 - The first string
str2 - The second string
Returns:
True, if the two strings are equal

safeHashCode

public static final int safeHashCode(java.lang.Object obj)
Returns the hashcode of the object. If the object is null, 0 is returned.

Parameters:
obj - The object to get the hashcode of
Returns:
The hashcode of the object


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.