Interface WrapperPolicy

All Superinterfaces:
Serializable

public interface WrapperPolicy extends Serializable

Purpose: The wrapper policy can be used to wrap all objects read from the database in another object. This allows for EclipseLink to utilize one version of the class for its purposes and allows for the application to deal with another version of the object. The wrapper policy is used for things such as EJB Entity Beans and is directly used by the TopLink for WebLogic product for EJB Container Managed Persistence. It is assumed that relationships must be through the wrapper objects. Object identity is not maintained on the wrapper objects, only the wrapped object.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
    PUBLIC: Required: Lets the policy perform initialization.
    boolean
    PUBLIC: Required: Return true if the wrapped value should be traversed.
    boolean
    isWrapped(Object object)
    PUBLIC: Required: Return true if the object is already wrapped.
    void
    PUBLIC: Required: Set the descriptor.
    unwrapObject(Object proxy, org.eclipse.persistence.internal.sessions.AbstractSession session)
    PUBLIC: Required: Unwrap the object to return the implementation that is meant to be used by EclipseLink.
    wrapObject(Object original, org.eclipse.persistence.internal.sessions.AbstractSession session)
    PUBLIC: Required: Wrap the object to return the implementation that the application requires.
  • Method Details

    • initialize

      void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
      PUBLIC: Required: Lets the policy perform initialization.
      Parameters:
      session - the session to initialize against
      Throws:
      DescriptorException
    • isTraversable

      boolean isTraversable()
      PUBLIC: Required: Return true if the wrapped value should be traversed. Normally the wrapped value is looked after independently, it is not required to be traversed.
    • isWrapped

      boolean isWrapped(Object object)
      PUBLIC: Required: Return true if the object is already wrapped.
    • setDescriptor

      void setDescriptor(ClassDescriptor descriptor)
      PUBLIC: Required: Set the descriptor.
      Parameters:
      descriptor - the descriptor for the object being wrapped
    • unwrapObject

      Object unwrapObject(Object proxy, org.eclipse.persistence.internal.sessions.AbstractSession session)
      PUBLIC: Required: Unwrap the object to return the implementation that is meant to be used by EclipseLink. The object may already be unwrapped in which case the object should be returned.
      Parameters:
      proxy - the wrapped object
      session - the session to unwrap into
    • wrapObject

      Object wrapObject(Object original, org.eclipse.persistence.internal.sessions.AbstractSession session)
      PUBLIC: Required: Wrap the object to return the implementation that the application requires. The object may already be wrapped in which case the object should be returned.
      Parameters:
      original - , the object to be wrapped
      session - the session to wrap the object against.
      Returns:
      java.lang.Object the wrapped object