FileDocCategorySizeDatePackage
NoIndirectionPolicy.javaAPI DocGlassfish v2 API10792Tue May 22 16:54:36 BST 2007oracle.toplink.essentials.internal.indirection

NoIndirectionPolicy

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.
see
ForeignReferenceMapping
author
Mike Norman
since
TOPLink/Java 2.5

Fields Summary
Constructors Summary
public NoIndirectionPolicy()
INTERNAL: Construct a new indirection policy.

        super();
    
Methods Summary
public java.lang.ObjectcloneAttribute(java.lang.Object attributeValue, java.lang.Object original, java.lang.Object clone, oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl unitOfWork, boolean buildDirectlyFromRow)
INTERNAL: Return a clone of the attribute.

param
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.

        // Since valueFromRow was called with the UnitOfWork, attributeValue
        // is already a registered result.
        if (buildDirectlyFromRow) {
            return attributeValue;
        }
        boolean isExisting = unitOfWork.isObjectRegistered(clone) && (!(unitOfWork.isOriginalNewObject(original)));
        return this.getMapping().buildCloneForPartObject(attributeValue, original, clone, unitOfWork, isExisting);
    
protected booleancollectionTypeIsValid(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).

        return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType);
    
public oracle.toplink.essentials.internal.sessions.AbstractRecordextractReferenceRow(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.

        return null;
    
public java.lang.ObjectgetOriginalIndirectionObject(java.lang.Object unitOfWorkIndirectionObject, oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Return the original indirection object for a unit of work indirection object.

        // This code appears broken, but actually is unreachable because
        // only called when indirection is true.
        return unitOfWorkIndirectionObject;
    
public java.lang.ObjectgetRealAttributeValueFromObject(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.

        return attribute;
    
public java.lang.ObjectnullValueFromRow()
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.

        return null;
    
public booleanobjectIsInstantiated(java.lang.Object object)
INTERNAL: Return whether the specified object is instantiated.

        return true;
    
protected booleantypeIsValid(java.lang.Class attributeType)
INTERNAL: Return whether the type is appropriate for the indirection policy. In this case, the attribute type CANNOT be ValueHolderInterface.

        return attributeType != ClassConstants.ValueHolderInterface_Class;
    
public booleanusesIndirection()
INTERNAL: Return whether the indirection policy actually uses indirection. Here, we must reply false.

        return false;
    
public voidvalidateDeclaredAttributeType(java.lang.Class attributeType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
INTERNAL: 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.

        super.validateDeclaredAttributeType(attributeType, checker);
        if (!this.typeIsValid(attributeType)) {
            checker.handleError(DescriptorException.attributeAndMappingWithoutIndirectionMismatch(this.getMapping()));
        }
    
public voidvalidateDeclaredAttributeTypeForCollection(java.lang.Class attributeType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
INTERNAL: 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).

        super.validateDeclaredAttributeTypeForCollection(attributeType, checker);
        if (!this.collectionTypeIsValid(attributeType)) {
            checker.handleError(DescriptorException.attributeTypeNotValid(this.getCollectionMapping()));
        }
    
public voidvalidateGetMethodReturnType(java.lang.Class returnType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
INTERNAL: 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.

        super.validateGetMethodReturnType(returnType, checker);
        if (!this.typeIsValid(returnType)) {
            checker.handleError(DescriptorException.returnAndMappingWithoutIndirectionMismatch(this.getMapping()));
        }
    
public voidvalidateGetMethodReturnTypeForCollection(java.lang.Class returnType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
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. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).

        super.validateGetMethodReturnTypeForCollection(returnType, checker);
        if (!this.collectionTypeIsValid(returnType)) {
            checker.handleError(DescriptorException.getMethodReturnTypeNotValid(getCollectionMapping()));
        }
    
public voidvalidateSetMethodParameterType(java.lang.Class parameterType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
INTERNAL: 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.

        super.validateSetMethodParameterType(parameterType, checker);
        if (!this.typeIsValid(parameterType)) {
            checker.handleError(DescriptorException.parameterAndMappingWithoutIndirectionMismatch(this.getMapping()));
        }
    
public voidvalidateSetMethodParameterTypeForCollection(java.lang.Class parameterType, oracle.toplink.essentials.exceptions.IntegrityChecker checker)
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. In this case, the type MUST be a Vector (or, in the case of jdk1.2, Collection or Map).

        super.validateSetMethodParameterTypeForCollection(parameterType, checker);
        if (!this.collectionTypeIsValid(parameterType)) {
            checker.handleError(DescriptorException.setMethodParameterTypeNotValid(getCollectionMapping()));
        }
    
public java.lang.ObjectvalueFromQuery(oracle.toplink.essentials.queryframework.ReadQuery query, oracle.toplink.essentials.internal.sessions.AbstractRecord row, oracle.toplink.essentials.internal.sessions.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.

        return session.executeQuery(query, row);
    
public java.lang.ObjectvalueFromRow(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.

        return object;