public interface CloneFunction<T>
This two step process is important because this is what allows circular references in the cloned object graph.
Modifier and Type | Method and Description |
---|---|
void |
cloneFields(Cloner cloner,
T clone,
T original)
Performs a deep clone of the specified clone's fields.
|
T |
cloneObject(Cloner cloner,
T original)
Performs a shallow clone of the specified object.
|
T cloneObject(Cloner cloner, T original)
cloner
- The cloner performing the cloning operation.original
- The original object that needs to be cloned.void cloneFields(Cloner cloner, T clone, T original)
cloner
- The cloner performing the cloning operation.clone
- The clone previously returned from cloneObject().original
- The original object that was cloned. This is provided for
the very special case where field cloning needs to refer to
the original object. Mostly the necessary fields should already
be on the clone.