org.eclipse.persistence.descriptors.copying
Class AbstractCopyPolicy

java.lang.Object
  extended by org.eclipse.persistence.descriptors.copying.AbstractCopyPolicy
All Implemented Interfaces:
Serializable, Cloneable, CopyPolicy
Direct Known Subclasses:
CloneCopyPolicy, InstantiationCopyPolicy, PersistenceEntityCopyPolicy

public abstract class AbstractCopyPolicy
extends Object
implements CopyPolicy

Purpose: Allows customization of how an object is cloned. This class defines common behavior that allows a subclass to be used and set on a descriptor to provide a special cloning routine for how an object is cloned in a unit of work.

See Also:
Serialized Form

Constructor Summary
AbstractCopyPolicy()
           
 
Method Summary
abstract  Object buildClone(Object domainObject, Session session)
          Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.
 Object buildWorkingCopyClone(Object domainObject, Session session)
          By default use the buildClone.
 Object buildWorkingCopyCloneFromRow(Record row, ObjectBuildingQuery query, Object primaryKey, UnitOfWork uow)
          By default create a new instance.
 Object clone()
          INTERNAL: Clones the CopyPolicy
 void initialize(Session session)
          Do nothing by default.
 void setDescriptor(ClassDescriptor descriptor)
          Set the descriptor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.persistence.descriptors.copying.CopyPolicy
buildsNewInstance
 

Constructor Detail

AbstractCopyPolicy

public AbstractCopyPolicy()
Method Detail

buildClone

public abstract Object buildClone(Object domainObject,
                                  Session session)
                           throws DescriptorException
Description copied from interface: CopyPolicy
Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.

Specified by:
buildClone in interface CopyPolicy
Throws:
DescriptorException

buildWorkingCopyClone

public Object buildWorkingCopyClone(Object domainObject,
                                    Session session)
                             throws DescriptorException
By default use the buildClone.

Specified by:
buildWorkingCopyClone in interface CopyPolicy
Throws:
DescriptorException

buildWorkingCopyCloneFromRow

public Object buildWorkingCopyCloneFromRow(Record row,
                                           ObjectBuildingQuery query,
                                           Object primaryKey,
                                           UnitOfWork uow)
                                    throws DescriptorException
By default create a new instance.

Specified by:
buildWorkingCopyCloneFromRow in interface CopyPolicy
Throws:
DescriptorException

clone

public Object clone()
INTERNAL: Clones the CopyPolicy

Specified by:
clone in interface CopyPolicy
Overrides:
clone in class Object

initialize

public void initialize(Session session)
                throws DescriptorException
Do nothing by default.

Specified by:
initialize in interface CopyPolicy
Throws:
DescriptorException

setDescriptor

public void setDescriptor(ClassDescriptor descriptor)
Set the descriptor.

Specified by:
setDescriptor in interface CopyPolicy