com.webmethods.caf.common
Class EqualsUtil

java.lang.Object
  extended by com.webmethods.caf.common.EqualsUtil

public final class EqualsUtil
extends Object

The following utility class allows simple construction of an effective equals method. It is based on the recommendations of Effective Java, by Joshua Bloch.


Constructor Summary
EqualsUtil()
           
 
Method Summary
static boolean areEqual(boolean aThis, boolean aThat)
          Compares two boolean values
static boolean areEqual(char aThis, char aThat)
          Compares two char values
static boolean areEqual(double aThis, double aThat)
          Compares two double values
static boolean areEqual(float aThis, float aThat)
          Compares two float values
static boolean areEqual(long aThis, long aThat)
          Compares two long, byte, short or int values
static boolean areEqual(Object aThis, Object aThat)
          Possibly-null object field.
static boolean areEqualWithConstantTiming(String strA, String strB)
          MWS-7695: Use a constant time string comparison function to guard against timing attacks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EqualsUtil

public EqualsUtil()
Method Detail

areEqual

public static boolean areEqual(boolean aThis,
                               boolean aThat)
Compares two boolean values

Parameters:
aThis - first boolean to be compared
aThat - first boolean to be compared
Returns:
if two boolean are equal

areEqual

public static boolean areEqual(char aThis,
                               char aThat)
Compares two char values

Parameters:
aThis - first char to be compared
aThat - first char to be compared
Returns:
if two chars are equal

areEqual

public static boolean areEqual(long aThis,
                               long aThat)
Compares two long, byte, short or int values

Parameters:
aThis - first value to be compared
aThat - first value to be compared
Returns:
if two values are equal

areEqual

public static boolean areEqual(float aThis,
                               float aThat)
Compares two float values

Parameters:
aThis - first float to be compared
aThat - first float to be compared
Returns:
if two float values are equal

areEqual

public static boolean areEqual(double aThis,
                               double aThat)
Compares two double values

Parameters:
aThis - first double to be compared
aThat - second double to be compared
Returns:
if two values are equal

areEqual

public static boolean areEqual(Object aThis,
                               Object aThat)
Possibly-null object field. Includes type-safe enumerations and collections, but does not include arrays. See class comment.


areEqualWithConstantTiming

public static boolean areEqualWithConstantTiming(String strA,
                                                 String strB)
MWS-7695: Use a constant time string comparison function to guard against timing attacks