com.uwyn.rife.tools
Class ObjectUtils

java.lang.Object
  extended by com.uwyn.rife.tools.ObjectUtils

public class ObjectUtils
extends Object


Constructor Summary
ObjectUtils()
           
 
Method Summary
static
<T> T
deepClone(T object)
          Try to create a deep clone of the provides object.
static
<T> T
genericClone(T object)
          Clone an Object if possible.
static Class getBaseClass(Object object)
          This routine returns the base class of an object.
 
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

genericClone

public static <T> T genericClone(T object)
Clone an Object if possible. This method returns an Object which is a clone of the input object. It checks if the method implements the Cloneable interface and then uses reflection to invoke the clone method.

Parameters:
object - The object to be cloned.
Returns:
null if the cloning failed; or

the cloned Object instance.


deepClone

public static <T> T deepClone(T object)
                   throws CloneNotSupportedException
Try to create a deep clone of the provides object. This handles arrays, collections and maps. If the class in not a supported standard JDK collection type the genericClone will be used instead.

Parameters:
object - The object to be copied.
Throws:
CloneNotSupportedException

getBaseClass

public static Class getBaseClass(Object object)
This routine returns the base class of an object. This is just the class of the object for non-arrays.

Parameters:
object - The object whose base class you want to retrieve.


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.