http://java.sun.com/j2se/1.3/docs/ap...t.html#clone()
Copying an object will typically entail creating a new instance of its class, but it also may require copying of internal data structures as well. No constructors are called.
- http://jakarta.apache.org/commons/la....Serializable)
SerializationUtils
public static Object clone(Serializable object)
Deep clone an Object using serialization.
This is many times slower than writing clone methods by hand on all objects in your object graph. However, for complex object graphs, or for those that don't support deep cloning this can be a simple alternative implementation. Of course all the objects must be Serializable.
Parameters:
object - the Serializable object to clone
Returns:
the cloned object
Throws:
SerializationException - (runtime) if the serialization fails- http://jakarta.apache.org/commons/lang/api-release/org/apache/commons/lang/ArrayUtils.html#clone(java.lang.Object[])
- http://java.sun.com/developer/Books/...a/Chapter3.pdf
Partager