org.infoglue.cms.util
Class DomainUtils

java.lang.Object
  extended by org.infoglue.cms.util.DomainUtils

public final class DomainUtils
extends java.lang.Object

Utility class for the domain objects. This class cannot be instantiated.

Author:
Frank Febbraro (frank@phase2technology.com)

Method Summary
static int compare(java.lang.Comparable c1, java.lang.Comparable c2)
          Compares two comparable objects, considering the possibility that one or both may be null.
static boolean equals(java.util.Collection c1, java.util.Collection c2)
          Compares two collections for equality, considering the possibility that one or both may be null.
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          Compares two objects for equality, considering the possibility that one or both may be null.
static int hashCode(java.lang.Object s)
          Returns an appropriate hash code for the given object, considering the possibilty that the object may be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
Compares two objects for equality, considering the possibility that one or both may be null.

Parameters:
o1 - an object
o2 - another object
Returns:
true if o1 is null and o1 == o2, or o1.equals(o2) returns true; otherwise returns false.

equals

public static boolean equals(java.util.Collection c1,
                             java.util.Collection c2)
Compares two collections for equality, considering the possibility that one or both may be null.

Parameters:
c1 - a collection
c2 - another collection
Returns:
true if c1.size() == c2.size(), c1.containsAll(c2), and c2.containsAll(c1). This keeps the semantics consistent across the various collection implementations.

compare

public static int compare(java.lang.Comparable c1,
                          java.lang.Comparable c2)
Compares two comparable objects, considering the possibility that one or both may be null.

Parameters:
c1 - an object
c2 - another object
Returns:
0 if o1 and 02 are null, -1 if c1 is not null and c2 is null, 1 if c1 is null and c2 is not null, or c1.compareTo(o2) otherwise.

hashCode

public static int hashCode(java.lang.Object s)
Returns an appropriate hash code for the given object, considering the possibilty that the object may be null.

Parameters:
s - a string
Returns:
if s is null, returns 0, otherwise returns s.hashCode().


Copyright © 2005 InfoGlue.org All Rights Reserved.