Top Description Fields Constructors Methods
org.eclipse.persistence.descriptors.copying

public Class CloneCopyPolicy

extends AbstractCopyPolicy
Class Inheritance
Imports
java.lang.reflect.Method, org.eclipse.persistence.exceptions.DescriptorException, org.eclipse.persistence.internal.descriptors.ObjectBuilder, org.eclipse.persistence.internal.helper.Helper, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.internal.sessions.AbstractRecord, org.eclipse.persistence.queries.ObjectBuildingQuery, org.eclipse.persistence.sessions.DataRecord, .Session, .UnitOfWork

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

Field Summary

Modifier and TypeField and Description
protected transient Method
protected String
methodName

Allow for clone method to be specified.

protected transient Method
protected String
Inherited from org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy:
descriptor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
public boolean
buildsNewInstance()

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildsNewInstance.

Return false as a shallow clone is returned, not a new instance.
public Object
buildWorkingCopyClone(Object domainObject, Session session)

Overrides org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.buildWorkingCopyClone.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildWorkingCopyClone.

Clone through the workingCopyClone method, or if not specified the clone method.
public Object
buildWorkingCopyCloneFromRow(DataRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWork uow)

Overrides org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.buildWorkingCopyCloneFromRow.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildWorkingCopyCloneFromRow.

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.

public String
getMethodName()

Return the clone method name.

protected Method
getWorkingCopyMethod()

Return the workingCopyClone method.

public String
getWorkingCopyMethodName()

Return the workingCopyClone method name.

public void
protected void
setMethod(Method method)

Set the clone method.

public void
setMethodName(String methodName)

Set the clone method name.

protected void
setWorkingCopyMethod(Method method)

Set the workingCopyClone method.

public void
setWorkingCopyMethodName(String methodName)

Set the workingCopyClone method name.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy:
clonegetDescriptorsetDescriptor

Field Detail

methodback to summary
protected transient Method method
methodNameback to summary
protected String methodName

Allow for clone method to be specified.

workingCopyMethodback to summary
protected transient Method workingCopyMethod
workingCopyMethodNameback to summary
protected String workingCopyMethodName

Constructor Detail

CloneCopyPolicyback to summary
public CloneCopyPolicy()

Method Detail

buildCloneback to summary
public Object buildClone(Object domainObject, Session session) throws DescriptorException

Implements abstract org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.buildClone.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildClone.

Clone through calling the clone method.

Annotations
@Override
buildsNewInstanceback to summary
public boolean buildsNewInstance()

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildsNewInstance.

Return false as a shallow clone is returned, not a new instance.

Annotations
@Override
buildWorkingCopyCloneback to summary
public Object buildWorkingCopyClone(Object domainObject, Session session) throws DescriptorException

Overrides org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.buildWorkingCopyClone.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildWorkingCopyClone.

Clone through the workingCopyClone method, or if not specified the clone method.

Annotations
@Override
buildWorkingCopyCloneFromRowback to summary
public Object buildWorkingCopyCloneFromRow(DataRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWork uow) throws DescriptorException

Overrides org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.buildWorkingCopyCloneFromRow.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.buildWorkingCopyCloneFromRow.

Create a new instance, unless a workingCopyClone method is specified, then build a new instance and clone it.

Annotations
@Override
getMethodback to summary
protected Method getMethod()

Return the clone method.

getMethodNameback to summary
public String getMethodName()

Return the clone method name.

getWorkingCopyMethodback to summary
protected Method getWorkingCopyMethod()

Return the workingCopyClone method. This is used to clone within a unit of work.

getWorkingCopyMethodNameback to summary
public String getWorkingCopyMethodName()

Return the workingCopyClone method name. This is used to clone within a unit of work.

initializeback to summary
public void initialize(Session session) throws DescriptorException

Overrides org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy.initialize.

Implements org.eclipse.persistence.descriptors.copying.CopyPolicy.initialize.

Validate and build the methods.

Annotations
@Override
setMethodback to summary
protected void setMethod(Method method)

Set the clone method.

setMethodNameback to summary
public void setMethodName(String methodName)

Set the clone method name.

setWorkingCopyMethodback to summary
protected void setWorkingCopyMethod(Method method)

Set the workingCopyClone method. This is used to clone within a unit of work.

setWorkingCopyMethodNameback to summary
public void setWorkingCopyMethodName(String methodName)

Set the workingCopyClone method name. This is used to clone within a unit of work.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override