Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.descriptors.copying
Class AbstractCopyPolicy

java.lang.Object
  extended by oracle.toplink.descriptors.copying.AbstractCopyPolicy
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CopyPolicy
Direct Known Subclasses:
CloneCopyPolicy, InstantiationCopyPolicy

public abstract class AbstractCopyPolicy
extends java.lang.Object
implements CopyPolicy

Purpose: Allows customization of how an object is cloned. This class defines common behavoir 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  java.lang.Object buildClone(java.lang.Object domainObject, Session session)
          Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.
abstract  boolean buildsNewInstance()
          Return if a new instance is created or a clone.
 java.lang.Object buildWorkingCopyClone(java.lang.Object domainObject, Session session)
          By default use the buildClone.
 java.lang.Object buildWorkingCopyCloneFromPrimaryKeyObject(java.lang.Object primaryKeyObject, ObjectBuildingQuery query, UnitOfWork uow)
          By default create a new instance.
 java.lang.Object buildWorkingCopyCloneFromRow(Record row, ObjectBuildingQuery query, java.util.Vector primaryKey, UnitOfWork uow)
          By default create a new instance.
 java.lang.Object buildWorkingCopyCloneFromRow(Record row, ObjectLevelReadQuery query, java.util.Vector primaryKey, UnitOfWork uow)
          Create a new instance, unless a workingCopyClone method is specified, then build a new instance and clone it.
 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
 

Constructor Detail

AbstractCopyPolicy

public AbstractCopyPolicy()
Method Detail

buildClone

public abstract java.lang.Object buildClone(java.lang.Object domainObject,
                                            Session session)
                                     throws DescriptorException
Description copied from interface: oracle.toplink.descriptors.copying.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 java.lang.Object buildWorkingCopyClone(java.lang.Object domainObject,
                                              Session session)
                                       throws DescriptorException
By default use the buildClone.

Specified by:
buildWorkingCopyClone in interface CopyPolicy
Throws:
DescriptorException

buildWorkingCopyCloneFromPrimaryKeyObject

public java.lang.Object buildWorkingCopyCloneFromPrimaryKeyObject(java.lang.Object primaryKeyObject,
                                                                  ObjectBuildingQuery query,
                                                                  UnitOfWork uow)
By default create a new instance.

Specified by:
buildWorkingCopyCloneFromPrimaryKeyObject in interface CopyPolicy

buildWorkingCopyCloneFromRow

public java.lang.Object buildWorkingCopyCloneFromRow(Record row,
                                                     ObjectLevelReadQuery query,
                                                     java.util.Vector primaryKey,
                                                     UnitOfWork uow)
                                              throws DescriptorException
Create a new instance, unless a workingCopyClone method is specified, then build a new instance and clone it.

Throws:
DescriptorException

buildWorkingCopyCloneFromRow

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

Specified by:
buildWorkingCopyCloneFromRow in interface CopyPolicy
Throws:
DescriptorException

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

buildsNewInstance

public abstract boolean buildsNewInstance()
Return if a new instance is created or a clone.

Specified by:
buildsNewInstance in interface CopyPolicy

Copyright © 1998, 2010, Oracle. All Rights Reserved.