public class CloneCopyPolicy extends AbstractCopyPolicy
Purpose: Allows a clone of an object to be created with a method that returns the cloned object. It is possible to define methods for two types of clones 1. methodName can be set to define the method EclipseLink uses to clone objects for it's own internal use. The objects created by this method will not be visible to the user, and instead used as a basis for comparison when a DeferredChangeDetectionPolicy used. This method will also be in place of the workingCopyMethod if it is not provided 2. workingCopyMethod this method is used to create the clone that is returned to the user when an Object is registered in a UnitOfWork
Modifier and Type | Field and Description |
---|---|
protected Method |
method |
protected String |
methodName
Allow for clone method to be specified.
|
protected Method |
workingCopyMethod |
protected String |
workingCopyMethodName |
descriptor
Constructor and Description |
---|
CloneCopyPolicy() |
Modifier and Type | Method and Description |
---|---|
Object |
buildClone(Object domainObject,
Session session)
Clone through calling the clone method.
|
boolean |
buildsNewInstance()
Return false as a shallow clone is returned, not a new instance.
|
Object |
buildWorkingCopyClone(Object domainObject,
Session session)
Clone through the workingCopyClone method, or if not specified the clone method.
|
Object |
buildWorkingCopyCloneFromRow(Record row,
ObjectBuildingQuery query,
Object primaryKey,
UnitOfWork uow)
Create a new instance, unless a workingCopyClone method is specified, then build a new instance and clone it.
|
protected Method |
getMethod()
Return the clone method.
|
String |
getMethodName()
Return the clone method name.
|
protected Method |
getWorkingCopyMethod()
Return the workingCopyClone method.
|
String |
getWorkingCopyMethodName()
Return the workingCopyClone method name.
|
void |
initialize(Session session)
Validate and build the methods.
|
protected void |
setMethod(Method method)
Set the clone method.
|
void |
setMethodName(String methodName)
Set the clone method name.
|
protected void |
setWorkingCopyMethod(Method method)
Set the workingCopyClone method.
|
void |
setWorkingCopyMethodName(String methodName)
Set the workingCopyClone method name.
|
String |
toString() |
clone, getDescriptor, setDescriptor
protected String methodName
protected String workingCopyMethodName
protected transient Method method
protected transient Method workingCopyMethod
public Object buildClone(Object domainObject, Session session) throws DescriptorException
buildClone
in interface CopyPolicy
buildClone
in class AbstractCopyPolicy
DescriptorException
public Object buildWorkingCopyClone(Object domainObject, Session session) throws DescriptorException
buildWorkingCopyClone
in interface CopyPolicy
buildWorkingCopyClone
in class AbstractCopyPolicy
DescriptorException
public Object buildWorkingCopyCloneFromRow(Record row, ObjectBuildingQuery query, Object primaryKey, UnitOfWork uow) throws DescriptorException
buildWorkingCopyCloneFromRow
in interface CopyPolicy
buildWorkingCopyCloneFromRow
in class AbstractCopyPolicy
DescriptorException
protected Method getMethod()
public String getMethodName()
protected Method getWorkingCopyMethod()
public String getWorkingCopyMethodName()
public void initialize(Session session) throws DescriptorException
initialize
in interface CopyPolicy
initialize
in class AbstractCopyPolicy
DescriptorException
protected void setMethod(Method method)
public void setMethodName(String methodName)
protected void setWorkingCopyMethod(Method method)
public void setWorkingCopyMethodName(String methodName)
public boolean buildsNewInstance()
Copyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.