org.springframework.util
Class ObjectUtils

java.lang.Object
  extended byorg.springframework.util.ObjectUtils

public abstract class ObjectUtils
extends Object

Miscellaneous object utility methods. Mainly for internal use within the framework; consider Jakarta's Commons Lang for a more comprehensive suite of object utilities.

Since:
19.03.2004
Author:
Juergen Hoeller, Keith Donald, Rod Johnson
See Also:
org.apache.commons.lang.ObjectUtils

Constructor Summary
ObjectUtils()
           
 
Method Summary
static String getIdentityHexString(Object o)
          Return a hex string form of an object's identity hash code.
static boolean isCheckedException(Throwable ex)
          Return whether the given throwable is a checked exception, i.e. an Exception but not a RuntimeException.
static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions)
          Check whether the given exception is compatible with the exceptions declared in a throws clause.
static boolean nullSafeEquals(Object o1, Object o2)
          Determine if the given objects are equal, returning true if both are null or false if only one is null.
static Object[] toObjectArray(Object primitiveArray)
          Convert a primitive array to an object array of primitive wrapper objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectUtils

public ObjectUtils()
Method Detail

nullSafeEquals

public static boolean nullSafeEquals(Object o1,
                                     Object o2)
Determine if the given objects are equal, returning true if both are null or false if only one is null.

Parameters:
o1 - first Object to compare
o2 - second Object to compare
Returns:
whether the given objects are equal

getIdentityHexString

public static String getIdentityHexString(Object o)
Return a hex string form of an object's identity hash code.

Parameters:
o - the object
Returns:
the object's identity code in hex

isCheckedException

public static boolean isCheckedException(Throwable ex)
Return whether the given throwable is a checked exception, i.e. an Exception but not a RuntimeException.

Parameters:
ex - the throwable to check
Returns:
whether the throwable is a checked exception
See Also:
Exception, RuntimeException

isCompatibleWithThrowsClause

public static boolean isCompatibleWithThrowsClause(Throwable ex,
                                                   Class[] declaredExceptions)
Check whether the given exception is compatible with the exceptions declared in a throws clause.

Parameters:
ex - the exception to checked
declaredExceptions - the exceptions declared in the throws clause
Returns:
whether the given exception is compatible

toObjectArray

public static Object[] toObjectArray(Object primitiveArray)
Convert a primitive array to an object array of primitive wrapper objects.

Parameters:
primitiveArray - the primitive array
Returns:
the object array
Throws:
IllegalArgumentException - if the parameter is not a primitive array


Copyright (C) 2003-2004 The Spring Framework Project.