Class NoIndirectionPolicy
- java.lang.Object
-
- org.eclipse.persistence.internal.indirection.IndirectionPolicy
-
- org.eclipse.persistence.internal.indirection.NoIndirectionPolicy
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class NoIndirectionPolicy extends IndirectionPolicy
Purpose
: NoIndirectionPolicy implements the behavior necessary for a a ForeignReferenceMapping (or TransformationMapping) to directly use domain objects, as opposed to ValueHolders.- Since:
- TOPLink/Java 2.5
- Author:
- Mike Norman
- See Also:
ForeignReferenceMapping, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.indirection.IndirectionPolicy
mapping
-
-
Constructor Summary
Constructors Constructor Description NoIndirectionPolicy()INTERNAL: Construct a new indirection policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectbuildIndirectObject(ValueHolderInterface valueHolder)INTERNAL: This method can be used when an Indirection Object is required to be built from a provided ValueHolderInterface object.java.lang.ObjectcloneAttribute(java.lang.Object attributeValue, java.lang.Object original, CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean buildDirectlyFromRow)INTERNAL: Return a clone of the attribute.protected booleancollectionTypeIsValid(java.lang.Class collectionType)INTERNAL: Return whether the collection type is appropriate for the indirection policy.AbstractRecordextractReferenceRow(java.lang.Object referenceObject)INTERNAL: Return the reference row for the reference object.voidfixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession session)INTERNAL: An object has been serialized from the server to the client.java.lang.ObjectgetOriginalIndirectionObject(java.lang.Object unitOfWorkIndirectionObject, AbstractSession session)INTERNAL: Return the original indirection object for a unit of work indirection object.java.lang.ObjectgetOriginalValueHolder(java.lang.Object unitOfWorkIndirectionObject, AbstractSession session)INTERNAL: Return the original valueHolder object.java.lang.ObjectgetRealAttributeValueFromObject(java.lang.Object object, java.lang.Object attribute)INTERNAL: Return the "real" attribute value, as opposed to any wrapper.java.lang.ObjectgetValueFromRemoteValueHolder(RemoteValueHolder remoteValueHolder)INTERNAL: Extract and return the appropriate value from the specified remote value holder.voidmergeRemoteValueHolder(java.lang.Object clientSideDomainObject, java.lang.Object serverSideDomainObject, MergeManager mergeManager)INTERNAL Replace the client value holder with the server value holder, after copying some of the settings from the client value holder.java.lang.ObjectnullValueFromRow()INTERNAL: Return the null value of the appropriate attribute.booleanobjectIsEasilyInstantiated(java.lang.Object object)INTERNAL: Return whether the specified object can be instantiated without database access.booleanobjectIsInstantiated(java.lang.Object object)INTERNAL: Return whether the specified object is instantiated.voidsetRealAttributeValueInObject(java.lang.Object target, java.lang.Object attributeValue, boolean trackChanges)Set the value of the appropriate attribute of target to attributeValue.protected booleantypeIsValid(java.lang.Class attributeType)INTERNAL: Return whether the type is appropriate for the indirection policy.booleanusesIndirection()INTERNAL: Return whether the indirection policy actually uses indirection.voidvalidateDeclaredAttributeType(java.lang.Class attributeType, IntegrityChecker checker)INTERNAL: Verify that attributeType is correct for the indirection policy.voidvalidateDeclaredAttributeTypeForCollection(java.lang.Class attributeType, IntegrityChecker checker)INTERNAL: Verify that attributeType is an appropriate collection type for the indirection policy.voidvalidateGetMethodReturnType(java.lang.Class returnType, IntegrityChecker checker)INTERNAL: Verify that getter returnType is correct for the indirection policy.voidvalidateGetMethodReturnTypeForCollection(java.lang.Class returnType, IntegrityChecker checker)INTERNAL: Verify that getter returnType is an appropriate collection type for the indirection policy.voidvalidateSetMethodParameterType(java.lang.Class parameterType, IntegrityChecker checker)INTERNAL: Verify that setter parameterType is correct for the indirection policy.voidvalidateSetMethodParameterTypeForCollection(java.lang.Class parameterType, IntegrityChecker checker)INTERNAL: Verify that setter parameterType is an appropriate collection type for the indirection policy.java.lang.ObjectvalueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)INTERNAL: Return the value to be stored in the object's attribute.java.lang.ObjectvalueFromMethod(java.lang.Object object, AbstractRecord row, AbstractSession session)INTERNAL: Return the value to be stored in the object's attribute.java.lang.ObjectvalueFromQuery(ReadQuery query, AbstractRecord row, java.lang.Object sourceObject, AbstractSession session)INTERNAL: Return the value to be stored in the object's attribute.java.lang.ObjectvalueFromQuery(ReadQuery query, AbstractRecord row, AbstractSession session)INTERNAL: Return the value to be stored in the object's attribute.java.lang.ObjectvalueFromRow(java.lang.Object object)INTERNAL: Return the value to be stored in the object's attribute.-
Methods inherited from class org.eclipse.persistence.internal.indirection.IndirectionPolicy
backupCloneAttribute, buildCascadeQuery, clone, extractPrimaryKeyForReferenceObject, getCollectionMapping, getForeignReferenceMapping, getMapping, getOneToOneMapping, getOriginalIndirectionObjectForMerge, getTransformationMapping, initialize, instantiateObject, isAttributeValueFullyBuilt, isWeavedObjectBasicIndirectionPolicy, iterateOnAttributeValue, mergeClientIntoServerValueHolder, objectIsInstantiatedOrChanged, reset, setMapping, setRealAttributeValueInObject, setSourceObject, setUseLazyInstantiation, shouldUseLazyInstantiation, usesTransparentIndirection, validateAttributeOfInstantiatedObject, validateContainerPolicy
-
-
-
-
Method Detail
-
buildIndirectObject
public java.lang.Object buildIndirectObject(ValueHolderInterface valueHolder)
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.- Specified by:
buildIndirectObjectin classIndirectionPolicy
-
cloneAttribute
public java.lang.Object cloneAttribute(java.lang.Object attributeValue, java.lang.Object original, CacheKey cacheKey, java.lang.Object clone, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean buildDirectlyFromRow)INTERNAL: Return a clone of the attribute.- Specified by:
cloneAttributein classIndirectionPolicy- Parameters:
buildDirectlyFromRow- 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.
-
collectionTypeIsValid
protected boolean collectionTypeIsValid(java.lang.Class collectionType)
INTERNAL: Return whether the collection type is appropriate for the indirection policy. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).
-
extractReferenceRow
public AbstractRecord extractReferenceRow(java.lang.Object referenceObject)
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.- Specified by:
extractReferenceRowin classIndirectionPolicy
-
fixObjectReferences
public void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, DistributedSession session)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.- Specified by:
fixObjectReferencesin classIndirectionPolicy
-
getOriginalIndirectionObject
public java.lang.Object getOriginalIndirectionObject(java.lang.Object unitOfWorkIndirectionObject, AbstractSession session)INTERNAL: Return the original indirection object for a unit of work indirection object.- Specified by:
getOriginalIndirectionObjectin classIndirectionPolicy
-
getOriginalValueHolder
public java.lang.Object getOriginalValueHolder(java.lang.Object unitOfWorkIndirectionObject, AbstractSession session)INTERNAL: Return the original valueHolder object. Access to the underlying valueholder may be required when serializing the valueholder or converting the valueHolder to another type.- Specified by:
getOriginalValueHolderin classIndirectionPolicy
-
getRealAttributeValueFromObject
public java.lang.Object getRealAttributeValueFromObject(java.lang.Object object, java.lang.Object attribute)INTERNAL: Return the "real" attribute value, as opposed to any wrapper. This will trigger the wrapper to instantiate the value.- Specified by:
getRealAttributeValueFromObjectin classIndirectionPolicy
-
getValueFromRemoteValueHolder
public java.lang.Object getValueFromRemoteValueHolder(RemoteValueHolder remoteValueHolder)
INTERNAL: Extract and return the appropriate value from the specified remote value holder.- Specified by:
getValueFromRemoteValueHolderin classIndirectionPolicy
-
mergeRemoteValueHolder
public void mergeRemoteValueHolder(java.lang.Object clientSideDomainObject, java.lang.Object serverSideDomainObject, MergeManager mergeManager)INTERNAL Replace the client value holder with the server value holder, after copying some of the settings from the client value holder.- Specified by:
mergeRemoteValueHolderin classIndirectionPolicy
-
nullValueFromRow
public java.lang.Object 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.- Specified by:
nullValueFromRowin classIndirectionPolicy
-
objectIsInstantiated
public boolean objectIsInstantiated(java.lang.Object object)
INTERNAL: Return whether the specified object is instantiated.- Specified by:
objectIsInstantiatedin classIndirectionPolicy
-
objectIsEasilyInstantiated
public boolean objectIsEasilyInstantiated(java.lang.Object object)
INTERNAL: Return whether the specified object can be instantiated without database access.- Specified by:
objectIsEasilyInstantiatedin classIndirectionPolicy
-
typeIsValid
protected boolean typeIsValid(java.lang.Class attributeType)
INTERNAL: Return whether the type is appropriate for the indirection policy. In this case, the attribute type CANNOT be ValueHolderInterface.
-
usesIndirection
public boolean usesIndirection()
INTERNAL: Return whether the indirection policy actually uses indirection. Here, we must reply false.- Overrides:
usesIndirectionin classIndirectionPolicy
-
validateDeclaredAttributeType
public void validateDeclaredAttributeType(java.lang.Class attributeType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that attributeType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the attribute type CANNOT be ValueHolderInterface.- Overrides:
validateDeclaredAttributeTypein classIndirectionPolicy- Throws:
DescriptorException
-
validateDeclaredAttributeTypeForCollection
public void validateDeclaredAttributeTypeForCollection(java.lang.Class attributeType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that attributeType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).- Overrides:
validateDeclaredAttributeTypeForCollectionin classIndirectionPolicy- Throws:
DescriptorException
-
validateGetMethodReturnType
public void validateGetMethodReturnType(java.lang.Class returnType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that getter returnType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the return type CANNOT be ValueHolderInterface.- Overrides:
validateGetMethodReturnTypein classIndirectionPolicy- Throws:
DescriptorException
-
validateGetMethodReturnTypeForCollection
public void validateGetMethodReturnTypeForCollection(java.lang.Class returnType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that getter returnType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).- Overrides:
validateGetMethodReturnTypeForCollectionin classIndirectionPolicy- Throws:
DescriptorException
-
validateSetMethodParameterType
public void validateSetMethodParameterType(java.lang.Class parameterType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that setter parameterType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the parameter type CANNOT be ValueHolderInterface.- Overrides:
validateSetMethodParameterTypein classIndirectionPolicy- Throws:
DescriptorException
-
validateSetMethodParameterTypeForCollection
public void validateSetMethodParameterTypeForCollection(java.lang.Class parameterType, IntegrityChecker checker) throws DescriptorExceptionINTERNAL: Verify that setter parameterType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).- Overrides:
validateSetMethodParameterTypeForCollectionin classIndirectionPolicy- Throws:
DescriptorException
-
valueFromBatchQuery
public java.lang.Object valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)
INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the batchQuery. In this case, extract the result from the query.- Specified by:
valueFromBatchQueryin classIndirectionPolicy
-
valueFromMethod
public java.lang.Object valueFromMethod(java.lang.Object object, AbstractRecord row, AbstractSession session)INTERNAL: Return the value to be stored in the object's attribute. This value is determined by invoking the mapping's AttributeTransformer- Specified by:
valueFromMethodin classIndirectionPolicy
-
valueFromQuery
public java.lang.Object valueFromQuery(ReadQuery query, AbstractRecord row, java.lang.Object sourceObject, AbstractSession session)
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.- Specified by:
valueFromQueryin classIndirectionPolicy
-
valueFromQuery
public java.lang.Object valueFromQuery(ReadQuery query, AbstractRecord row, AbstractSession session)
INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the query. In this case, simply execute the query and return its results.- Specified by:
valueFromQueryin classIndirectionPolicy
-
valueFromRow
public java.lang.Object valueFromRow(java.lang.Object object)
INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the row. In this case, simply return the object.- Specified by:
valueFromRowin classIndirectionPolicy
-
setRealAttributeValueInObject
public void setRealAttributeValueInObject(java.lang.Object target, java.lang.Object attributeValue, boolean trackChanges)Set the value of the appropriate attribute of target to attributeValue. In this case, place the value inside the target's ValueHolder. if trackChanges is true, set the value in the object as if the user was setting it. Allow change tracking to pick up the change.- Overrides:
setRealAttributeValueInObjectin classIndirectionPolicy
-
-