public abstract class ClassCopierBase extends java.lang.Object implements ClassCopier
Modifier | Constructor and Description |
---|---|
protected |
ClassCopierBase(java.lang.String name)
Pass a name here that can be used for toString, hashCode, and equals.
|
protected |
ClassCopierBase(java.lang.String name,
boolean isReflective) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
copy(java.util.Map<java.lang.Object,java.lang.Object> oldToNew,
java.lang.Object source)
Make the actual copy of source, using oldToNew to preserve aliasing.
|
protected abstract java.lang.Object |
createCopy(java.lang.Object source)
Create a copy of source.
|
protected java.lang.Object |
doCopy(java.util.Map<java.lang.Object,java.lang.Object> oldToNew,
java.lang.Object source,
java.lang.Object result)
Do the copying of data from source to result.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isReflectiveClassCopier()
We need to know whether this class copier operates via reflection
or not, as the reflective class copier must be able to tell
when a super class is copied by an incompatible copier.
|
java.lang.String |
toString() |
protected ClassCopierBase(java.lang.String name)
protected ClassCopierBase(java.lang.String name, boolean isReflective)
public final java.lang.String toString()
toString
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final java.lang.Object copy(java.util.Map<java.lang.Object,java.lang.Object> oldToNew, java.lang.Object source) throws ReflectiveCopyException
This split into two phases isolates all subclasses from the need to update oldToNew. It accommodates simple cases (arrays of primitives for example) that only need to define createCopy, as well as more complex case (general objects) that must first create the copy, update oldToNew, and then do the copy, as otherwise self-references would cause infinite recursion.
copy
in interface ClassCopier
ReflectiveCopyException
public boolean isReflectiveClassCopier()
ClassCopier
isReflectiveClassCopier
in interface ClassCopier
protected abstract java.lang.Object createCopy(java.lang.Object source) throws ReflectiveCopyException
ReflectiveCopyException
protected java.lang.Object doCopy(java.util.Map<java.lang.Object,java.lang.Object> oldToNew, java.lang.Object source, java.lang.Object result) throws ReflectiveCopyException
ReflectiveCopyException