Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle TopLink API Reference 10g Release 3 (10.1.3) B13698-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.toplink.descriptors.copying
Interface CopyPolicy

All Superinterfaces:
  java.lang.Cloneable, java.io.Serializable

All Known Implementing Classes:
  AbstractCopyPolicy

public interface CopyPolicy
extends java.lang.Cloneable, java.io.Serializable

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 MethodBasedCopyPolicy 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.

Method Summary
`java.lang.Object` | `buildClone(java.lang.Object object, Session session)` Return a shallow clone of the object for usage with object copying, or unit of work backup cloning.
`boolean` | `buildsNewInstance()` Return if this copy policy creates a new instance, vs a clone.
`java.lang.Object` | `buildWorkingCopyClone(java.lang.Object object, Session session)` Return a shallow clone of the object for usage with the unit of work working copy.
`java.lang.Object` | `buildWorkingCopyCloneFromRow(Record row, ObjectLevelReadQuery query)` Return an instance with the primary key set from the row, used for building a working copy during a unit of work transactional read.
`java.lang.Object` | `clone()` Clone the CopyPolicy.
`void` | `initialize(Session session)` Allow for any initialization or validation required.
`void` | `setDescriptor(Descriptor descriptor)` Set the descriptor.

Method Detail

### buildClone

    public java.lang.Object buildClone(java.lang.Object object,
                                       Session session)
                                throws DescriptorException

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

### buildWorkingCopyClone

    public java.lang.Object buildWorkingCopyClone(java.lang.Object object,
                                                  Session session)
                                           throws DescriptorException

  Return a shallow clone of the object for usage with the unit of work working copy.
  Throws:
    `DescriptorException`

### buildWorkingCopyCloneFromRow

    public java.lang.Object buildWorkingCopyCloneFromRow(Record row,
                                                         ObjectLevelReadQuery query)
                                                  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.
  Throws:
    `DescriptorException`

### clone

    public java.lang.Object clone()

  Clone the CopyPolicy.

### initialize

    public void initialize(Session session)
                    throws DescriptorException

  Allow for any initialization or validation required.
  Throws:
    `DescriptorException`

### setDescriptor

    public void setDescriptor(Descriptor descriptor)

  Set the descriptor.

### buildsNewInstance

    public boolean buildsNewInstance()

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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 1998, 2006, Oracle. All Rights Reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD