An IndirectionPolicy acts as a 'rules' holder that determines the behavior of a ForeignReferenceMapping (or TransformationMapping) with respect to indirection, or lack thereof.
IndirectionPolicy is an abstract class that defines the protocol to be implemented by subclasses so that the assorted DatabaseMappings can use an assortment of indirection policies:
Proxy)
ForeignReferenceMapping
| Modifier and Type | Field and Description |
|---|---|
| protected DatabaseMapping |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Object | backupCloneAttribute(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork)
INTERNAL: Return a backup clone of the attribute. |
| protected ReadObjectQuery | buildCascadeQuery(MergeManager mergeManager)
INTERNAL Return true if the refresh should refresh on this mapping or not. |
| public abstract Object | buildIndirectObject(ValueHolderInterface<T> valueHolder)
INTERNAL: This method can be used when an Indirection Object is required to be built from a provided ValueHolderInterface object. |
| public Object | |
| public abstract 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)INTERNAL: Return a clone of the attribute. |
| public Object | extractPrimaryKeyForReferenceObject(Object referenceObject, AbstractSession session)
INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping). |
| public abstract AbstractRecord | extractReferenceRow(Object referenceObject)
INTERNAL: Return the reference row for the reference object. |
| public abstract void | fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session)
INTERNAL: An object has been serialized from the server to the client. |
| protected CollectionMapping | |
| protected ForeignReferenceMapping | |
| public DatabaseMapping | |
| protected ObjectReferenceMapping | |
| public abstract Object | getOriginalIndirectionObject(Object unitOfWorkIndirectionObject, AbstractSession session)
INTERNAL: Return the original indirection object for a unit of work indirection object. |
| public Object | getOriginalIndirectionObjectForMerge(Object unitOfWorkIndirectionObject, AbstractSession session)
INTERNAL: Return the original indirection object for a unit of work indirection object. |
| public abstract Object | getOriginalValueHolder(Object unitOfWorkIndirectionObject, AbstractSession session)
INTERNAL: Return the original valueHolder object. |
| public abstract Object | getRealAttributeValueFromObject(Object object, Object attribute)
INTERNAL: Return the "real" attribute value, as opposed to any wrapper. |
| protected AbstractTransformationMapping | |
| public abstract Object | getValueFromRemoteValueHolder(RemoteValueHolder<?> remoteValueHolder)
INTERNAL: Extract and return the appropriate value from the specified remote value holder. |
| public void | |
| public void | |
| public boolean | isAttributeValueFullyBuilt(Object attributeValue)
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 | |
| public void | iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue)
INTERNAL: Iterate over the specified attribute value, heeding the settings in the iterator. |
| protected void | mergeClientIntoServerValueHolder(RemoteValueHolder<?> serverValueHolder, MergeManager mergeManager)
INTERNAL Replace the client value holder with the server value holder, after copying some of the settings from the client value holder. |
| public abstract void | mergeRemoteValueHolder(Object clientSideDomainObject, 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. |
| public abstract Object | |
| public abstract boolean | objectIsEasilyInstantiated(Object object)
INTERNAL: Return whether the specified object can be instantiated without database access. |
| public abstract boolean | |
| public boolean | objectIsInstantiatedOrChanged(Object object)
INTERNAL: Return whether the specified object is instantiated, or if it has changes. |
| public void | |
| public void | setMapping(DatabaseMapping mapping)
INTERNAL: set the database mapping that uses the indirection policy. |
| public void | setRealAttributeValueInObject(Object target, Object attributeValue)
INTERNAL: Set the value of the appropriate attribute of target to attributeValue. |
| public void | setRealAttributeValueInObject(Object target, Object attributeValue, boolean allowChangeTracking)
INTERNAL: Same functionality as setRealAttributeValueInObject(Object target, Object attributeValue) but allows overridden behavior for IndirectionPolicies that track changes |
| public void | setSourceObject(Object sourceObject, Object attributeValue)
INTERNAL: set the source object into QueryBasedValueHolder. |
| public void | setUseLazyInstantiation(Boolean useLazyInstantiation)
ADVANCED: This method will only change the behavior of TransparentIndirectionPolicy. |
| public Boolean | shouldUseLazyInstantiation()
ADVANCED: Returns false unless this is a transparent indirection policy IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them. |
| public boolean | |
| public boolean | usesTransparentIndirection()
INTERNAL: Return whether the indirection policy uses transparent indirection. |
| public Object | validateAttributeOfInstantiatedObject(Object attributeValue)
INTERNAL: Verify that the value of the attribute within an instantiated object is of the appropriate type for the indirection policy. |
| public void | validateContainerPolicy(IntegrityChecker checker)
INTERNAL: Verify that the container policy is compatible with the indirection policy. |
| public void | validateDeclaredAttributeType(Class<?> attributeType, IntegrityChecker checker)
INTERNAL: Verify that attributeType is correct for the indirection policy. |
| public void | validateDeclaredAttributeTypeForCollection(Class<?> attributeType, IntegrityChecker checker)
INTERNAL: Verify that attributeType is an appropriate collection type for the indirection policy. |
| public void | validateGetMethodReturnType(Class<?> returnType, IntegrityChecker checker)
INTERNAL: Verify that getter returnType is correct for the indirection policy. |
| public void | validateGetMethodReturnTypeForCollection(Class<?> returnType, IntegrityChecker checker)
INTERNAL: Verify that getter returnType is an appropriate collection type for the indirection policy. |
| public void | validateSetMethodParameterType(Class<?> parameterType, IntegrityChecker checker)
INTERNAL: Verify that setter parameterType is correct for the indirection policy. |
| public void | validateSetMethodParameterTypeForCollection(Class<?> parameterType, IntegrityChecker checker)
INTERNAL: Verify that setter parameterType is an appropriate collection type for the indirection policy. |
| public abstract Object | valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)
INTERNAL: Return the value to be stored in the object's attribute. |
| public abstract Object | valueFromMethod(Object object, AbstractRecord row, AbstractSession session)
INTERNAL: Return the value to be stored in the object's attribute. |
| public abstract Object | valueFromQuery(ReadQuery query, AbstractRecord row, Object sourceObject, AbstractSession session)
INTERNAL: Return the value to be stored in the object's attribute. |
| public abstract Object | valueFromQuery(ReadQuery query, AbstractRecord row, AbstractSession session)
INTERNAL: Return the value to be stored in the object's attribute. |
| public abstract Object |
| mapping | back to summary |
|---|---|
| protected DatabaseMapping mapping | |
| IndirectionPolicy | back to summary |
|---|---|
| protected IndirectionPolicy() INTERNAL: Construct a new indirection policy. | |
| backupCloneAttribute | back to summary |
|---|---|
| public Object backupCloneAttribute(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Return a backup clone of the attribute. | |
| buildCascadeQuery | back to summary |
|---|---|
| protected ReadObjectQuery buildCascadeQuery(MergeManager mergeManager) INTERNAL Return true if the refresh should refresh on this mapping or not. | |
| buildIndirectObject | back to summary |
|---|---|
| public abstract Object buildIndirectObject(ValueHolderInterface<T> 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. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. INTERNAL: Clones itself.
| |
| cloneAttribute | back to summary |
|---|---|
| public abstract Object cloneAttribute(Object attributeValue, Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession, boolean buildDirectlyFromRow) INTERNAL: Return a clone of the attribute.
| |
| extractPrimaryKeyForReferenceObject | back to summary |
|---|---|
| public Object extractPrimaryKeyForReferenceObject(Object referenceObject, AbstractSession session) INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping). This key will be used by a RemoteValueHolder. | |
| extractReferenceRow | back to summary |
|---|---|
| public abstract AbstractRecord extractReferenceRow(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. | |
| fixObjectReferences | back to summary |
|---|---|
| public abstract void fixObjectReferences(Object object, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> 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. | |
| getCollectionMapping | back to summary |
|---|---|
| protected CollectionMapping getCollectionMapping() INTERNAL: Reduce casting clutter.... | |
| getForeignReferenceMapping | back to summary |
|---|---|
| protected ForeignReferenceMapping getForeignReferenceMapping() INTERNAL: Reduce casting clutter.... | |
| getMapping | back to summary |
|---|---|
| public DatabaseMapping getMapping() INTERNAL: Return the database mapping that uses the indirection policy. | |
| getOneToOneMapping | back to summary |
|---|---|
| protected ObjectReferenceMapping getOneToOneMapping() INTERNAL: Reduce casting clutter.... | |
| getOriginalIndirectionObject | back to summary |
|---|---|
| public abstract Object getOriginalIndirectionObject(Object unitOfWorkIndirectionObject, AbstractSession session) INTERNAL: Return the original indirection object for a unit of work indirection object. | |
| getOriginalIndirectionObjectForMerge | back to summary |
|---|---|
| public Object getOriginalIndirectionObjectForMerge(Object unitOfWorkIndirectionObject, AbstractSession session) INTERNAL: Return the original indirection object for a unit of work indirection object. | |
| getOriginalValueHolder | back to summary |
|---|---|
| public abstract Object getOriginalValueHolder(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. | |
| getRealAttributeValueFromObject | back to summary |
|---|---|
| public abstract Object getRealAttributeValueFromObject(Object object, Object attribute) INTERNAL: Return the "real" attribute value, as opposed to any wrapper. This will trigger the wrapper to instantiate the value. | |
| getTransformationMapping | back to summary |
|---|---|
| protected AbstractTransformationMapping getTransformationMapping() INTERNAL: Reduce casting clutter.... | |
| getValueFromRemoteValueHolder | back to summary |
|---|---|
| public abstract Object getValueFromRemoteValueHolder(RemoteValueHolder<?> remoteValueHolder) INTERNAL: Extract and return the appropriate value from the specified remote value holder. | |
| initialize | back to summary |
|---|---|
| public void initialize() INTERNAL: Initialize the indirection policy (Do nothing by default) | |
| instantiateObject | back to summary |
|---|---|
| public void instantiateObject(Object object, Object attribute) INTERNAL: Trigger the instantiation of the value. | |
| isAttributeValueFullyBuilt | back to summary |
|---|---|
| public boolean isAttributeValueFullyBuilt(Object attributeValue) 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 | |
| isWeavedObjectBasicIndirectionPolicy | back to summary |
|---|---|
| public boolean isWeavedObjectBasicIndirectionPolicy() INTERNAL: | |
| iterateOnAttributeValue | back to summary |
|---|---|
| public void iterateOnAttributeValue(DescriptorIterator iterator, Object attributeValue) INTERNAL: Iterate over the specified attribute value, heeding the settings in the iterator. | |
| mergeClientIntoServerValueHolder | back to summary |
|---|---|
| protected void mergeClientIntoServerValueHolder(RemoteValueHolder<?> serverValueHolder, MergeManager mergeManager) INTERNAL Replace the client value holder with the server value holder, after copying some of the settings from the client value holder. | |
| mergeRemoteValueHolder | back to summary |
|---|---|
| public abstract void mergeRemoteValueHolder(Object clientSideDomainObject, 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. | |
| nullValueFromRow | back to summary |
|---|---|
| public abstract 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. | |
| objectIsEasilyInstantiated | back to summary |
|---|---|
| public abstract boolean objectIsEasilyInstantiated(Object object) INTERNAL: Return whether the specified object can be instantiated without database access. | |
| objectIsInstantiated | back to summary |
|---|---|
| public abstract boolean objectIsInstantiated(Object object) INTERNAL: Return whether the specified object is instantiated. | |
| objectIsInstantiatedOrChanged | back to summary |
|---|---|
| public boolean objectIsInstantiatedOrChanged(Object object) INTERNAL: Return whether the specified object is instantiated, or if it has changes. | |
| reset | back to summary |
|---|---|
| public void reset(Object target) Reset the wrapper used to store the value. This is only required if a wrapper is used. | |
| setMapping | back to summary |
|---|---|
| public void setMapping(DatabaseMapping mapping) INTERNAL: set the database mapping that uses the indirection policy. | |
| setRealAttributeValueInObject | back to summary |
|---|---|
| public void setRealAttributeValueInObject(Object target, Object attributeValue) INTERNAL: Set the value of the appropriate attribute of target to attributeValue. In this case, simply place the value inside the target. | |
| setRealAttributeValueInObject | back to summary |
|---|---|
| public void setRealAttributeValueInObject(Object target, Object attributeValue, boolean allowChangeTracking) INTERNAL: Same functionality as setRealAttributeValueInObject(Object target, Object attributeValue) but allows overridden behavior for IndirectionPolicies that track changes | |
| setSourceObject | back to summary |
|---|---|
| public void setSourceObject(Object sourceObject, Object attributeValue) INTERNAL: set the source object into QueryBasedValueHolder. Used only by transparent indirection. | |
| setUseLazyInstantiation | back to summary |
|---|---|
| public void setUseLazyInstantiation(Boolean useLazyInstantiation) ADVANCED: This method will only change the behavior of TransparentIndirectionPolicy. IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them. IndirectList defaults to this behavior. When Set to true, the collection associated with this TransparentIndirection will be setup so as not to instantiate for adds and removes. The weakness of this setting for an IndirectSet is that when the set is not instantiated, if a duplicate element is added, it will not be detected until commit time. | |
| shouldUseLazyInstantiation | back to summary |
|---|---|
| public Boolean shouldUseLazyInstantiation() ADVANCED: Returns false unless this is a transparent indirection policy IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them. IndirectList defaults to this behavior. When Set to true, the collection associated with this TransparentIndirection will be setup so as not to instantiate for adds and removes. The weakness of this setting for an IndirectSet is that when the set is not instantiated, if a duplicate element is added, it will not be detected until commit time. | |
| usesIndirection | back to summary |
|---|---|
| public boolean usesIndirection() INTERNAL: Return whether the indirection policy actually uses indirection. The default is true. | |
| usesTransparentIndirection | back to summary |
|---|---|
| public boolean usesTransparentIndirection() INTERNAL: Return whether the indirection policy uses transparent indirection. The default is false. | |
| validateAttributeOfInstantiatedObject | back to summary |
|---|---|
| public Object validateAttributeOfInstantiatedObject(Object attributeValue) throws DescriptorException INTERNAL: Verify that the value of the attribute within an instantiated object is of the appropriate type for the indirection policy. If it is incorrect, throw an exception. If the value is null return a new indirection object to be used for the attribute. | |
| validateContainerPolicy | back to summary |
|---|---|
| public void validateContainerPolicy(IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that the container policy is compatible with the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateDeclaredAttributeType | back to summary |
|---|---|
| public void validateDeclaredAttributeType(Class<?> attributeType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that attributeType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateDeclaredAttributeTypeForCollection | back to summary |
|---|---|
| public void validateDeclaredAttributeTypeForCollection(Class<?> attributeType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that attributeType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateGetMethodReturnType | back to summary |
|---|---|
| public void validateGetMethodReturnType(Class<?> returnType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that getter returnType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateGetMethodReturnTypeForCollection | back to summary |
|---|---|
| public void validateGetMethodReturnTypeForCollection(Class<?> returnType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that getter returnType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateSetMethodParameterType | back to summary |
|---|---|
| public void validateSetMethodParameterType(Class<?> parameterType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that setter parameterType is correct for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| validateSetMethodParameterTypeForCollection | back to summary |
|---|---|
| public void validateSetMethodParameterTypeForCollection(Class<?> parameterType, IntegrityChecker checker) throws DescriptorException INTERNAL: Verify that setter parameterType is an appropriate collection type for the indirection policy. If it is incorrect, add an exception to the integrity checker. | |
| valueFromBatchQuery | back to summary |
|---|---|
| public abstract 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. | |
| valueFromMethod | back to summary |
|---|---|
| public abstract Object valueFromMethod(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 appropriate method on the object and passing it the row and session. | |
| valueFromQuery | back to summary |
|---|---|
| public abstract Object valueFromQuery(ReadQuery query, AbstractRecord row, Object sourceObject, AbstractSession session) INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the query. | |
| valueFromQuery | back to summary |
|---|---|
| public abstract 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. | |
| valueFromRow | back to summary |
|---|---|
| public abstract Object valueFromRow(Object object) INTERNAL: Return the value to be stored in the object's attribute. This value is determined by the row. | |