Top Description Fields Constructors Methods
org.eclipse.persistence.internal.indirection

public Class ProxyIndirectionPolicy

extends BasicIndirectionPolicy
Class Inheritance
Imports
java.lang.reflect.Proxy, java.util.Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.DescriptorException, .IntegrityChecker, org.eclipse.persistence.indirection.ValueHolder, .ValueHolderInterface, org.eclipse.persistence.internal.descriptors.DescriptorIterator, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .MergeManager, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.ObjectDescriptor, .RemoteSessionController, .RemoteUnitOfWork, org.eclipse.persistence.queries.ObjectLevelReadQuery, .ReadQuery, org.eclipse.persistence.sessions.remote.DistributedSession

ProxyIndirectionPolicy

Define the behavior for Proxy Indirection.

Proxy Indirection uses the Proxy and InvocationHandler features of JDK 1.3 to provide "transparent indirection" for 1:1 relationships. In order to use Proxy Indirection:

In this policy, proxy objects are returned during object creation. When a message other than toString is called on the proxy the real object data is retrieved from the database.
Author
Rick Barkhouse
Since
TopLink 3.0
See Also
org.eclipse.persistence.internal.indirection.ProxyIndirectionHandler

Field Summary

Modifier and TypeField and Description
private final Class<?>[]

Constructor Summary

AccessConstructor and Description
public
ProxyIndirectionPolicy(Class<?>[] targetInterfaces)

public

Method Summary

Modifier and TypeMethod and Description
public Object
backupCloneAttribute(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.backupCloneAttribute.

INTERNAL: Return a backup clone of the attribute.
public Object
cloneAttribute(Object attributeValue, Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession, boolean
indicates that we are building the clone directly from a row as opposed to building the original from the row, putting it in the shared cache, and then cloning the original.
buildDirectlyFromRow
)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.cloneAttribute.

INTERNAL: Return a clone of the attribute.
public AbstractRecord
extractReferenceRow(Object referenceObject)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.extractReferenceRow.

INTERNAL: Return the reference row for the reference object.
public void
fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.fixObjectReferences.

INTERNAL: An object has been serialized from the server to the client.
public Object
getOriginalIndirectionObject(Object unitOfWorkIndirectionObject, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.getOriginalIndirectionObject.

INTERNAL: Return the original indirection object for a unit of work indirection object.
public Object
getRealAttributeValueFromObject(Object obj, Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.getRealAttributeValueFromObject.

INTERNAL: Return the "real" attribute value, as opposed to any wrapper.
public static Object
getValueFromProxy(Object value)

INTERNAL: Given a proxy object, trigger the indirection and return the actual object represented by the proxy.

public boolean
hasTargetInterfaces()

INTERNAL: Return if targetInterfaces is not empty.

public void
public boolean
isAttributeValueFullyBuilt(Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.isAttributeValueFullyBuilt.

INTERNAL: The method validateAttributeOfInstantiatedObject(Object attributeValue) fixes the value of the attributeValue in cases where it is null and indirection requires that it contain some specific data structure.
public boolean
isValidType(Class<?> attributeType)

INTERNAL: Verify that a class type is valid to use for the proxy.

public void
iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.iterateOnAttributeValue.

INTERNAL: Iterate over the specified attribute value.
public void
mergeRemoteValueHolder(Object clientSideDomainObject, Object serverSideDomainObject, MergeManager mergeManager)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.mergeRemoteValueHolder.

INTERNAL: Replace the client value holder with the server value holder after copying some of the settings from the client value holder.
public Object
nullValueFromRow()

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.nullValueFromRow.

INTERNAL: Return the null value of the appropriate attribute.
public boolean
objectIsEasilyInstantiated(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.objectIsEasilyInstantiated.

INTERNAL: Return whether the specified object can be instantiated without database access.
public boolean
objectIsInstantiated(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.objectIsInstantiated.

INTERNAL: Return whether the specified object is instantiated.
public void
reset(Object target)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.reset.

Reset the wrapper used to store the value.
public void
setRealAttributeValueInObject(Object target, Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.setRealAttributeValueInObject.

INTERNAL: Set the "real" value of the attribute to attributeValue.
public Object
validateAttributeOfInstantiatedObject(Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateAttributeOfInstantiatedObject.

INTERNAL: Verify that the value of the attribute within an instantiated object is of the appropriate type for the indirection policy.
public void
validateDeclaredAttributeType(Class<?> attributeType, IntegrityChecker checker)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateDeclaredAttributeType.

INTERNAL: Verify that attribute type is correct for the indirection policy.
public void
validateGetMethodReturnType(Class<?> returnType, IntegrityChecker checker)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateGetMethodReturnType.

INTERNAL: Verify that the return type of the attribute's get method is correct for the indirection policy.
public void
validateSetMethodParameterType(Class<?> parameterType, IntegrityChecker checker)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateSetMethodParameterType.

INTERNAL: Verify that the parameter type of the attribute's set method is correct for the indirection policy.
public Object
valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromBatchQuery.

INTERNAL: Return the value to be stored in the object's attribute.
public Object
valueFromMethod(Object object, AbstractRecord row, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromMethod.

INTERNAL: Return the value to be stored in the object's attribute.
public Object
valueFromQuery(ReadQuery query, AbstractRecord row, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromQuery.

INTERNAL: Return the value to be stored in the object's attribute.
public Object
valueFromRow(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromRow.

INTERNAL: Return the value to be stored in the object's attribute.
Inherited from org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy:
buildIndirectObjectextractPrimaryKeyForReferenceObjectgetOriginalIndirectionObjectForMergegetOriginalValueHoldergetValueFromRemoteValueHoldersetSourceObjecttypeIsValidvalueFromQuery

Field Detail

targetInterfacesback to summary
private final Class<?>[] targetInterfaces

Constructor Detail

ProxyIndirectionPolicyback to summary
public ProxyIndirectionPolicy(Class<?>[] targetInterfaces)
ProxyIndirectionPolicyback to summary
public ProxyIndirectionPolicy()

Method Detail

backupCloneAttributeback to summary
public Object backupCloneAttribute(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.backupCloneAttribute.

INTERNAL: Return a backup clone of the attribute.

Annotations
@Override
@SuppressWarnings:unchecked
cloneAttributeback to summary
public Object cloneAttribute(Object attributeValue, Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession, boolean buildDirectlyFromRow)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.cloneAttribute.

INTERNAL: Return a clone of the attribute.

Parameters
buildDirectlyFromRow:boolean

indicates that we are building the clone directly from a row as opposed to building the original from the row, putting it in the shared cache, and then cloning the original.

Annotations
@Override
@SuppressWarnings:unchecked
extractReferenceRowback to summary
public AbstractRecord extractReferenceRow(Object referenceObject)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.extractReferenceRow.

INTERNAL: Return the reference row for the reference object. This allows the new row to be built without instantiating the reference object. Return null if the object has already been instantiated.

Annotations
@Override
fixObjectReferencesback to summary
public void fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.fixObjectReferences.

INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.

Annotations
@Override
getOriginalIndirectionObjectback to summary
public Object getOriginalIndirectionObject(Object unitOfWorkIndirectionObject, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.getOriginalIndirectionObject.

INTERNAL: Return the original indirection object for a unit of work indirection object.

Annotations
@Override
getRealAttributeValueFromObjectback to summary
public Object getRealAttributeValueFromObject(Object obj, Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.getRealAttributeValueFromObject.

INTERNAL: Return the "real" attribute value, as opposed to any wrapper. This will trigger the wrapper to instantiate the value.

Annotations
@Override
getValueFromProxyback to summary
public static Object getValueFromProxy(Object value)

INTERNAL: Given a proxy object, trigger the indirection and return the actual object represented by the proxy.

hasTargetInterfacesback to summary
public boolean hasTargetInterfaces()

INTERNAL: Return if targetInterfaces is not empty.

initializeback to summary
public void initialize()

Overrides org.eclipse.persistence.internal.indirection.IndirectionPolicy.initialize.

INTERNAL: Nothing required.

Annotations
@Override
isAttributeValueFullyBuiltback to summary
public boolean isAttributeValueFullyBuilt(Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.isAttributeValueFullyBuilt.

INTERNAL: The method validateAttributeOfInstantiatedObject(Object attributeValue) fixes the value of the attributeValue in cases where it is null and indirection requires that it contain some specific data structure. Return whether this will happen. This method is used to help determine if indirection has been triggered

Annotations
@Override
See Also
validateAttributeOfInstantiatedObject(Object attributeValue)
isValidTypeback to summary
public boolean isValidType(Class<?> attributeType)

INTERNAL: Verify that a class type is valid to use for the proxy. The class must be one of the interfaces in targetInterfaces.

iterateOnAttributeValueback to summary
public void iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.iterateOnAttributeValue.

INTERNAL: Iterate over the specified attribute value.

Annotations
@Override
mergeRemoteValueHolderback to summary
public void mergeRemoteValueHolder(Object clientSideDomainObject, Object serverSideDomainObject, MergeManager mergeManager)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.mergeRemoteValueHolder.

INTERNAL: Replace the client value holder with the server value holder after copying some of the settings from the client value holder.

Annotations
@Override
nullValueFromRowback to summary
public Object nullValueFromRow()

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.nullValueFromRow.

INTERNAL: Return the null value of the appropriate attribute. That is, the field from the database is NULL, return what should be placed in the object's attribute as a result.

Annotations
@Override
objectIsEasilyInstantiatedback to summary
public boolean objectIsEasilyInstantiated(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.objectIsEasilyInstantiated.

INTERNAL: Return whether the specified object can be instantiated without database access.

Annotations
@Override
objectIsInstantiatedback to summary
public boolean objectIsInstantiated(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.objectIsInstantiated.

INTERNAL: Return whether the specified object is instantiated.

Annotations
@Override
resetback to summary
public void reset(Object target)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.reset.

Reset the wrapper used to store the value.

Annotations
@Override
setRealAttributeValueInObjectback to summary
public void setRealAttributeValueInObject(Object target, Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.setRealAttributeValueInObject.

INTERNAL: Set the "real" value of the attribute to attributeValue.

Annotations
@Override
validateAttributeOfInstantiatedObjectback to summary
public Object validateAttributeOfInstantiatedObject(Object attributeValue)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateAttributeOfInstantiatedObject.

INTERNAL: Verify that the value of the attribute within an instantiated object is of the appropriate type for the indirection policy. In this case, the attribute must non-null and implement some public interface.

Annotations
@Override
validateDeclaredAttributeTypeback to summary
public void validateDeclaredAttributeType(Class<?> attributeType, IntegrityChecker checker) throws DescriptorException

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateDeclaredAttributeType.

INTERNAL: Verify that attribute type is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the attribute type must be contained in targetInterfaces.

Annotations
@Override
validateGetMethodReturnTypeback to summary
public void validateGetMethodReturnType(Class<?> returnType, IntegrityChecker checker) throws DescriptorException

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateGetMethodReturnType.

INTERNAL: Verify that the return type of the attribute's get method is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the return type must be a public interface.

Annotations
@Override
validateSetMethodParameterTypeback to summary
public void validateSetMethodParameterType(Class<?> parameterType, IntegrityChecker checker) throws DescriptorException

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.validateSetMethodParameterType.

INTERNAL: Verify that the parameter type of the attribute's set method is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the parameter type must be a public interface.

Annotations
@Override
valueFromBatchQueryback to summary
public Object valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromBatchQuery.

INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the batch query. * NOTE: Currently not supported anyway.

Annotations
@Override
valueFromMethodback to summary
public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromMethod.

INTERNAL: Return the value to be stored in the object's attribute. This value is determined by invoking the appropriate method on the object and passing it the row and session.

Annotations
@Override
valueFromQueryback to summary
public Object valueFromQuery(ReadQuery query, AbstractRecord row, AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromQuery.

INTERNAL: Return the value to be stored in the object's attribute. This will be a proxy object.

Annotations
@Override
valueFromRowback to summary
public Object valueFromRow(Object object)

Overrides org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy.valueFromRow.

INTERNAL: Return the value to be stored in the object's attribute. This will be a proxy object.

Annotations
@Override