Modifier and Type | Field and Description |
---|---|
protected Cloner |
defaultCloner |
protected InstanceProvider |
instanceProvider |
protected ObjectWriter |
writer |
Constructor and Description |
---|
FieldCloner(Cloner defaultCloner,
InstanceProvider instanceProvider)
Constructs a field cloner that copies objects by reading and writing the internal fields directly.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canClone(java.lang.Object source)
Determine whether or not the current cloner can clone the given object.
|
java.lang.Object |
clone(java.lang.Object source)
Perform the clone.
|
protected void |
defaultTransform(StructureModifier<java.lang.Object> modifierSource,
StructureModifier<java.lang.Object> modifierDest,
Cloner defaultCloner,
int fieldIndex)
Default implementation of the field transform.
|
Cloner |
getDefaultCloner()
Retrieve the default cloner used to clone the content of each field.
|
InstanceProvider |
getInstanceProvider()
Retrieve the instance provider this cloner is using to create new, empty classes.
|
protected Cloner defaultCloner
protected InstanceProvider instanceProvider
protected ObjectWriter writer
public FieldCloner(Cloner defaultCloner, InstanceProvider instanceProvider)
defaultCloner
- - the default cloner used while copying fields.instanceProvider
- - used to construct new, empty copies of a given type.protected void defaultTransform(StructureModifier<java.lang.Object> modifierSource, StructureModifier<java.lang.Object> modifierDest, Cloner defaultCloner, int fieldIndex)
modifierSource
- - modifier for the original object.modifierDest
- - modifier for the new cloned object.defaultCloner
- - cloner to use.fieldIndex
- - the current field index.public boolean canClone(java.lang.Object source)
Cloner
public java.lang.Object clone(java.lang.Object source)
Cloner
This method should never be called unless a corresponding Cloner.canClone(Object)
returns TRUE.
public Cloner getDefaultCloner()
public InstanceProvider getInstanceProvider()