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

public Class ContainerIndirectionPolicy

extends BasicIndirectionPolicy
Class Inheritance
Imports
java.lang.reflect.Constructor, org.eclipse.persistence.exceptions.DescriptorException, org.eclipse.persistence.indirection.IndirectContainer, .ValueHolder, .ValueHolderInterface, org.eclipse.persistence.internal.descriptors.DescriptorIterator, org.eclipse.persistence.internal.helper.ClassConstants, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.RemoteSessionController, .RemoteUnitOfWork, org.eclipse.persistence.queries.ObjectLevelReadQuery, .ReadQuery

Purpose: Provide ability for developers to wrap ValueHolders (Basic Indirection)

Responsibilities:

Author
Doug Clarke (TOP)
Since
2.5.0.5
See Also
org.eclipse.persistence.indirection.IndirectContainer

Field Summary

Modifier and TypeField and Description
private Class<?>
private String
private transient Constructor<?>

Constructor Summary

AccessConstructor and Description
public
ContainerIndirectionPolicy()

INTERNAL: Construct a new indirection policy.

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.
protected IndirectContainer<C>
buildContainer(final ValueHolderInterface<?> valueHolder)

Build a container with the initialized constructor.

public Object
buildIndirectObject(ValueHolderInterface<T> valueHolder)

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

INTERNAL: This method can be used when an Indirection Object is required to be built from a provided ValueHolderInterface object.
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 Class<?>
getContainerClass()

Returns the Container class which implements IndirectContainer.

public String
getContainerClassName()

INTERNAL: Used by MW.

protected Constructor<T>

Returns:

java.lang.reflect.Constructor
getContainerConstructor
()

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
getOriginalIndirectionObjectForMerge(Object unitOfWorkIndirectionObject, AbstractSession session)

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

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

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

INTERNAL: Return the "real" attribute value, as opposed to any wrapper.
public void
initialize()

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

INTERNAL: Ensure the container class implements IndirectContainer and that it has a constructor which can be used.
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 void
iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue)

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

INTERNAL: Iterate over the specified attribute value,
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
setContainerClass(Class<?> containerClass)

Sets the Container class which implements IndirectContainer

public void
setContainterClassName(String containerClassName)

Set the container classname for the MW

public void
setRealAttributeValueInObject(Object target, Object attributeValue)

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

INTERNAL: Set the value of the appropriate attribute of target to attributeValue.
protected boolean
typeIsValid(Class<?> attributeType)

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

INTERNAL: Return whether the type is appropriate for the indirection policy.
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 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:
extractPrimaryKeyForReferenceObjectfixObjectReferencesgetOriginalValueHoldergetValueFromRemoteValueHoldermergeRemoteValueHoldersetSourceObjectvalidateDeclaredAttributeTypevalidateGetMethodReturnTypevalidateSetMethodParameterTypevalueFromQuery

Field Detail

containerClassback to summary
private Class<?> containerClass
containerClassNameback to summary
private String containerClassName
containerConstructorback to summary
private transient Constructor<?> containerConstructor

Constructor Detail

ContainerIndirectionPolicyback to summary
public ContainerIndirectionPolicy()

INTERNAL: Construct a new indirection policy.

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
buildContainerback to summary
protected IndirectContainer<C> buildContainer(final ValueHolderInterface<?> valueHolder)

Build a container with the initialized constructor.

buildIndirectObjectback to summary
public Object buildIndirectObject(ValueHolderInterface<T> valueHolder)

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

INTERNAL: This method can be used when an Indirection Object is required to be built from a provided ValueHolderInterface object. This may be used for custom value holder types. Certain policies like the TransparentIndirectionPolicy may wrap the valueholder in another object.

Annotations
@Override
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
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
getContainerClassback to summary
public Class<?> getContainerClass()

Returns the Container class which implements IndirectContainer.

getContainerClassNameback to summary
public String getContainerClassName()

INTERNAL: Used by MW.

getContainerConstructorback to summary
protected Constructor<T> getContainerConstructor()
Returns:Constructor<T>

java.lang.reflect.Constructor

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
getOriginalIndirectionObjectForMergeback to summary
public Object getOriginalIndirectionObjectForMerge(Object unitOfWorkIndirectionObject, AbstractSession session)

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

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

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

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
initializeback to summary
public void initialize()

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

INTERNAL: Ensure the container class implements IndirectContainer and that it has a constructor which can be used.

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)
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
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. In this case, return an empty ValueHolder.

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
setContainerClassback to summary
public void setContainerClass(Class<?> containerClass)

Sets the Container class which implements IndirectContainer

setContainterClassNameback to summary
public void setContainterClassName(String containerClassName)

Set the container classname for the MW

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

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

INTERNAL: Set the value of the appropriate attribute of target to attributeValue. In this case, place the value inside the target's ValueHolder.

Annotations
@Override
typeIsValidback to summary
protected boolean typeIsValid(Class<?> attributeType)

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

INTERNAL: Return whether the type is appropriate for the indirection policy. In this case, the type must either be assignable from IndirectContainer or allow the conatinerClass to be assigned to it.

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 be non-null and it must be a ValueHolderInterface.

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 batchQuery. In this case, wrap the query in a ValueHolder for later invocation.

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. In this case, wrap the row in a ValueHolder for later use.

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 value is determined by the query. In this case, wrap the query in a ValueHolder for later invocation.

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 value is determined by the row. In this case, simply wrap the object in a ValueHolder.

Annotations
@Override