Class NoIndirectionPolicy

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class NoIndirectionPolicy
    extends IndirectionPolicy

    Purpose

    : NoIndirectionPolicy implements the behavior necessary for a a org.eclipse.persistence.mappings.ForeignReferenceMapping (or TransformationMapping) to directly use domain objects, as opposed to ValueHolders.
    Since:
    TOPLink/Java 2.5
    Author:
    Mike Norman
    See Also:
    Serialized Form
    • Constructor Detail

      • NoIndirectionPolicy

        public NoIndirectionPolicy()
        INTERNAL: Construct a new indirection policy.
    • Method Detail

      • buildIndirectObject

        public 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:
        buildIndirectObject in class IndirectionPolicy
      • cloneAttribute

        public Object cloneAttribute​(Object attributeValue,
                                     Object original,
                                     CacheKey cacheKey,
                                     Object clone,
                                     Integer refreshCascade,
                                     AbstractSession cloningSession,
                                     boolean buildDirectlyFromRow)
        INTERNAL: Return a clone of the attribute.
        Specified by:
        cloneAttribute in class IndirectionPolicy
        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​(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​(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:
        extractReferenceRow in class IndirectionPolicy
      • getOriginalValueHolder

        public 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.
        Specified by:
        getOriginalValueHolder in class IndirectionPolicy
      • mergeRemoteValueHolder

        public 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.
        Specified by:
        mergeRemoteValueHolder in class IndirectionPolicy
      • nullValueFromRow

        public 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:
        nullValueFromRow in class IndirectionPolicy
      • objectIsEasilyInstantiated

        public boolean objectIsEasilyInstantiated​(Object object)
        INTERNAL: Return whether the specified object can be instantiated without database access.
        Specified by:
        objectIsEasilyInstantiated in class IndirectionPolicy
      • typeIsValid

        protected boolean typeIsValid​(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:
        usesIndirection in class IndirectionPolicy
      • valueFromRow

        public Object valueFromRow​(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:
        valueFromRow in class IndirectionPolicy
      • setRealAttributeValueInObject

        public void setRealAttributeValueInObject​(Object target,
                                                  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:
        setRealAttributeValueInObject in class IndirectionPolicy