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

public Interface CopyPolicy

extends Cloneable, Serializable
Known Direct Implementers
org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy
Imports
java.io.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.queries.ObjectBuildingQuery, org.eclipse.persistence.sessions.*

Purpose: Allows customization of how an object is cloned. An implementer of CopyPolicy can be set on a descriptor to provide special cloning routine for how an object is cloned in a unit of work. By default the InstantiationCopyPolicy is used which creates a new instance of the class to be copied into. The CloneCopyPolicy can also be used that uses a clone method in the object to clone the object. When a clone method is used it avoid the requirement of having to copy over each of the direct attributes.

See Also
org.eclipse.persistence.descriptors.copying.CloneCopyPolicy, org.eclipse.persistence.descriptors.copying.InstantiationCopyPolicy

Method Summary

Modifier and TypeMethod and Description
public Object
buildClone(Object object, Session session)

Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.

public boolean
buildsNewInstance()

Return if this copy policy creates a new instance, vs a clone.

public Object
buildWorkingCopyClone(Object object, Session session)

Return a shallow clone of the object for usage with the unit of work working copy.

public Object
buildWorkingCopyCloneFromRow(DataRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWork uow)

Return an instance with the primary key set from the row, used for building a working copy during a unit of work transactional read.

public Object
clone()

Clone the CopyPolicy.

public void
initialize(Session session)

Allow for any initialization or validation required.

public void
setDescriptor(ClassDescriptor descriptor)

Set the descriptor.

Method Detail

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

Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.

buildsNewInstanceback to summary
public boolean buildsNewInstance()

Return if this copy policy creates a new instance, vs a clone.

buildWorkingCopyCloneback to summary
public Object buildWorkingCopyClone(Object object, Session session) throws DescriptorException

Return a shallow clone of the object for usage with the unit of work working copy.

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

Return an instance with the primary key set from the row, used for building a working copy during a unit of work transactional read.

cloneback to summary
public Object clone()

Clone the CopyPolicy.

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

Allow for any initialization or validation required.

setDescriptorback to summary
public void setDescriptor(ClassDescriptor descriptor)

Set the descriptor.