Package rife.tools
Class ObjectUtils
java.lang.Object
rife.tools.ObjectUtils
General purpose class containing common
Object manipulation
methods.- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TdeepClone(T object) Try to create a deep clone of the provides object.static <T> TgenericClone(T object) Clone an Object if possible.static ClassgetBaseClass(Object object) This routine returns the base class of an object.
-
Method Details
-
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:
nullif the cloning failed; orthe cloned
Objectinstance.
-
deepClone
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 thegenericClonewill be used instead.- Parameters:
object- The object to be copied.- Throws:
CloneNotSupportedException
-
getBaseClass
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.
-