public class AsmCloneStrategy extends AbstractCloneStrategy implements CloneStrategy
Constructor and Description |
---|
AsmCloneStrategy() |
Modifier and Type | Method and Description |
---|---|
protected <W> ClassModel<W> |
getClassModel(Class<W> clazz)
Obtain a ClassModel instance for the given class
|
protected <T> Object |
getFieldValue(T obj,
FieldModel<T> f)
Method to retrieve the value of a particular field
|
static AsmCloneStrategy |
getInstance()
Returns a shared instance of AsmCloneStrategy
|
protected <T> void |
handleClonePrimitiveField(T obj,
T copy,
CloneDriver driver,
FieldModel<T> f,
IdentityHashMap<Object,Object> referencesToReuse)
Method should clone the given primitive field
|
protected <T> void |
handleTransientField(T copy,
FieldModel<T> f)
Implementations should ensure that transient fields are left with the correct default (unset) value
|
<T> T |
newInstance(Class<T> c)
Create a new, uninitialised instance of the given class (if supported).
|
protected <T> void |
putFieldValue(T obj,
FieldModel<T> f,
Object value)
Put the given value into the target field
|
canClone, clone, handleArray, handleCloneField, initialiseFor, performCloneForCloneableMethod
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialiseFor
canClone, clone
public AsmCloneStrategy()
public <T> T newInstance(Class<T> c)
CloneImplementor
newInstance
in interface CloneImplementor
newInstance
in class AbstractCloneStrategy
T
- The type of the instance to be constructedc
- Type to create instance ofpublic static AsmCloneStrategy getInstance()
protected <T> void handleTransientField(T copy, FieldModel<T> f)
AbstractCloneStrategy
handleTransientField
in class AbstractCloneStrategy
T
- The type containing the fieldcopy
- The target objectf
- The FieldModel for the Field that should stay as a defaultprotected <W> ClassModel<W> getClassModel(Class<W> clazz)
AbstractCloneStrategy
getClassModel
in class AbstractCloneStrategy
W
- The type of classclazz
- Class to modelprotected <T> void handleClonePrimitiveField(T obj, T copy, CloneDriver driver, FieldModel<T> f, IdentityHashMap<Object,Object> referencesToReuse)
AbstractCloneStrategy
handleClonePrimitiveField
in class AbstractCloneStrategy
T
- The type being copiedobj
- Source objectcopy
- The target objectdriver
- The CloneDriver to usef
- The FieldModel for the Field that should stay as a defaultreferencesToReuse
- Used for tracking objects that have already been seenprotected <T> Object getFieldValue(T obj, FieldModel<T> f)
AbstractCloneStrategy
getFieldValue
in class AbstractCloneStrategy
T
- The type containing the fieldobj
- Source objectf
- The FieldModel for the Field that should stay as a defaultprotected <T> void putFieldValue(T obj, FieldModel<T> f, Object value)
AbstractCloneStrategy
putFieldValue
in class AbstractCloneStrategy
T
- The type containing the fieldobj
- Source objectf
- The FieldModel for the Field that should stay as a defaultvalue
- The value to putCopyright © 2010–2018 Jadira Systems. All rights reserved.