com.compoze.collab.util
Class ObjectUtility

java.lang.Object
  extended by com.compoze.collab.util.ObjectUtility

public class ObjectUtility
extends Object

Utility methods useful for objects and reflection.


Method Summary
static boolean isClassInstanceOf(Class clazz1, Class clazz2)
          Determines if objects of a given class are instances of objects of another class.
static Object newInstance(String sClass)
          Gets a new instance of a class using the default constructor.
static Object newInstance(String sClass, Class[] parameterTypes, Object[] initArgs)
          Gets a new instance of a class using a constructor that takes the given paremters.
static boolean objectsAreEqual(Object obj1, Object obj2)
          Determines if two objects are equal (allowing for null objects).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isClassInstanceOf

public static boolean isClassInstanceOf(Class clazz1,
                                        Class clazz2)
Determines if objects of a given class are instances of objects of another class.

Parameters
clazz1 - the superclass (not null)
clazz2 - the class to test (not null)

newInstance

public static Object newInstance(String sClass)
                          throws ClassNotFoundException,
                                 NoSuchMethodException,
                                 InstantiationException,
                                 IllegalAccessException,
                                 InvocationTargetException
Gets a new instance of a class using the default constructor.

Parameters
sClass - the fully qualified class name (not null)
Returns
the new instance (not null)
Throws
ClassNotFoundException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException

newInstance

public static Object newInstance(String sClass,
                                 Class[] parameterTypes,
                                 Object[] initArgs)
                          throws ClassNotFoundException,
                                 NoSuchMethodException,
                                 InstantiationException,
                                 IllegalAccessException,
                                 InvocationTargetException
Gets a new instance of a class using a constructor that takes the given paremters.

Parameters
sClass - the fully qualified class name (not null)
parameterTypes - the parameters that the constructor takes.
initArgs - the objects to use when creating an instance with the specified constructor.
Returns
a new instance of type sClass.
Throws
ClassNotFoundException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException

objectsAreEqual

public static boolean objectsAreEqual(Object obj1,
                                      Object obj2)
Determines if two objects are equal (allowing for null objects). The objects are equal if they are both null or obj1.equals(obj2) is true.

Parameters
obj1 - the first object (may be null)
obj2 - the second object (may be null)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved