public final class CloneObjectExtensions
extends java.lang.Object
CloneObjectExtensions provide methods for clone an object.| Modifier and Type | Method and Description |
|---|---|
static <T> T |
clone(T object)
Try to clone the given generic object.
|
static java.lang.Object |
cloneCloneable(java.lang.Object object)
Try to clone the given object that implements
Cloneable. |
static java.lang.Object |
cloneObject(java.lang.Object object)
Try to clone the given object.
|
static <T> T |
withCloner(T object)
Try to clone the given object with the external cloner
|
public static <T> T clone(T object)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.io.IOException
T - the generic typeobject - the object to clonejava.lang.NoSuchMethodException - Thrown if a matching method is not found or if the name is "<init>"or
"<clinit>".java.lang.SecurityException - Thrown if the security manager indicates a security violation.java.lang.IllegalAccessException - Thrown if this Method object is enforcing Java language access control
and the underlying method is inaccessible.java.lang.reflect.InvocationTargetException - Thrown if the property accessor method throws an exceptionjava.lang.ClassNotFoundException - occurs if a given class cannot be located by the specified class loaderjava.lang.InstantiationException - Thrown if one of the following reasons: the class object
voidjava.io.IOException - Signals that an I/O exception has occurred.public static java.lang.Object cloneCloneable(java.lang.Object object)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
Cloneable.object - The object to clone.java.lang.NoSuchMethodException - Thrown if a matching method is not found or if the name is "<init>"or
"<clinit>".java.lang.IllegalAccessException - Thrown if this Method object is enforcing Java language access control
and the underlying method is inaccessible.java.lang.reflect.InvocationTargetException - Thrown if the property accessor method throws an exceptionpublic static java.lang.Object cloneObject(java.lang.Object object)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.io.IOException
object - The object to clone.java.lang.NoSuchMethodException - Thrown if a matching method is not found or if the name is "<init>"or
"<clinit>".java.lang.SecurityException - Thrown if the security manager indicates a security violation.java.lang.IllegalAccessException - Thrown if this Method object is enforcing Java language access control
and the underlying method is inaccessible.java.lang.reflect.InvocationTargetException - Thrown if the property accessor method throws an exceptionjava.lang.ClassNotFoundException - occurs if a given class cannot be located by the specified class loaderjava.lang.InstantiationException - Thrown if one of the following reasons: the class object
voidjava.io.IOException - Signals that an I/O exception has occurred.public static <T> T withCloner(T object)
T - the generic typeobject - the object