Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.mappings.foundation
Class AbstractTransformationMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
      extended by oracle.toplink.mappings.foundation.AbstractTransformationMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
EISTransformationMapping, TransformationMapping, XMLTransformationMapping

public abstract class AbstractTransformationMapping
extends DatabaseMapping

Purpose: A transformation mapping is used for a specialized translation between how a value is represented in Java and its representation on the databae. Transformation mappings should only be used when other mappings are inadequate.

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Constructor Summary
AbstractTransformationMapping()
          Default constructor.
 
Method Summary
 void addFieldTransformation(DatabaseField field, java.lang.String methodName)
          Add the field and the name of the method that returns the value to be placed in said field when the object is written to the database.
 void addFieldTransformation(java.lang.String fieldName, java.lang.String methodName)
          Add the name of field and the name of the method that returns the value to be placed in said field when the object is written to the database.
 void addFieldTransformer(DatabaseField field, FieldTransformer transformer)
          Add the field and the transformer that returns the value to be placed in the field when the object is written to the database.
 void addFieldTransformer(java.lang.String fieldName, FieldTransformer transformer)
          Add the name of field and the transformer that returns the value to be placed in the field when the object is written to the database.
 void dontUseIndirection()
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 java.lang.String getAttributeMethodName()
          Return the attribute transformation method name.
 boolean isMutable()
          Return true if the attribute for this mapping is not a simple atomic value that cannot be modified, only replaced.
 void setAttributeMethodName(java.lang.String aMethodName)
          Deprecated. replaced by setAttributeTransformation(String)
 void setAttributeTransformation(java.lang.String methodName)
          To set the attribute method name.
 void setAttributeTransformer(AttributeTransformer transformer)
          Set the AttributeTransformer, this transformer will be used to extract the value for the object's attribute from the database row.
 void setIndirectionPolicy(oracle.toplink.internal.indirection.IndirectionPolicy indirectionPolicy)
          ADVANCED: Set the indirection policy.
 void setIsMutable(boolean mutable)
          Set if the value of the attribute is atomic or a complex mutable object and can be modified without replacing the entire object.
 void useBasicIndirection()
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 void useContainerIndirection(java.lang.Class containerClass)
          Indirection means that a IndirectContainer (wrapping a ValueHolder) will be put in-between the attribute and the real object.
 void useIndirection()
          Indirection means that a ValueHolder will be put in-between the attribute and the real object.
 boolean usesIndirection()
          Indirection meansthat a ValueHolder will be put in-between the attribute and the real object.
 
Methods inherited from class oracle.toplink.mappings.DatabaseMapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getProperty, getReferenceDescriptor, getSetMethodName, isLazy, isOptional, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsLazy, setIsOptional, setIsReadOnly, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTransformationMapping

public AbstractTransformationMapping()
Default constructor.

Method Detail

addFieldTransformation

public void addFieldTransformation(DatabaseField field,
                                   java.lang.String methodName)
Add the field and the name of the method that returns the value to be placed in said field when the object is written to the database. The method may take zero arguments, or it may take a single argument of type oracle.toplink.sessions.Session.


addFieldTransformation

public void addFieldTransformation(java.lang.String fieldName,
                                   java.lang.String methodName)
Add the name of field and the name of the method that returns the value to be placed in said field when the object is written to the database. The method may take zero arguments, or it may take a single argument of type oracle.toplink.sessions.Session.


addFieldTransformer

public void addFieldTransformer(java.lang.String fieldName,
                                FieldTransformer transformer)
Add the name of field and the transformer that returns the value to be placed in the field when the object is written to the database.


addFieldTransformer

public void addFieldTransformer(DatabaseField field,
                                FieldTransformer transformer)
Add the field and the transformer that returns the value to be placed in the field when the object is written to the database.


dontUseIndirection

public void dontUseIndirection()
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.


getAttributeMethodName

public java.lang.String getAttributeMethodName()
Return the attribute transformation method name.


isMutable

public boolean isMutable()
Return true if the attribute for this mapping is not a simple atomic value that cannot be modified, only replaced. This is true by default for non-primitives, but can be set to false to avoid cloning and change comparison in the unit of work.


setAttributeTransformer

public void setAttributeTransformer(AttributeTransformer transformer)
Set the AttributeTransformer, this transformer will be used to extract the value for the object's attribute from the database row.


setAttributeMethodName

public void setAttributeMethodName(java.lang.String aMethodName)
Deprecated. replaced by setAttributeTransformation(String)

To set the attribute transformation method name.


setAttributeTransformation

public void setAttributeTransformation(java.lang.String methodName)
To set the attribute method name. The method is invoked internally by TopLink to retreive the value to store in the domain object. The method receives Record as its parameter and optionally Session, and should extract the value from the record to set into the object, but should not set the value on the object, only return it.


setIsMutable

public void setIsMutable(boolean mutable)
Set if the value of the attribute is atomic or a complex mutable object and can be modified without replacing the entire object. This defaults to true for non-primitives, but can be set to false to optimize object cloning and change comparison.


setIndirectionPolicy

public void setIndirectionPolicy(oracle.toplink.internal.indirection.IndirectionPolicy indirectionPolicy)
ADVANCED: Set the indirection policy.


useBasicIndirection

public void useBasicIndirection()
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.


useContainerIndirection

public void useContainerIndirection(java.lang.Class containerClass)
Indirection means that a IndirectContainer (wrapping a ValueHolder) will be put in-between the attribute and the real object. This allows for the reading of the target from the database to be delayed until accessed. This defaults to true and is strongly suggested as it give a huge performance gain.


useIndirection

public void useIndirection()
Indirection means that a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.

See Also:
useBasicIndirection()

usesIndirection

public boolean usesIndirection()
Indirection meansthat a ValueHolder will be put in-between the attribute and the real object. This defaults to false and only required for transformations that perform database access.

See Also:
oracle.toplink.mappings.IndirectionPolicy

Copyright © 1998, 2010, Oracle. All Rights Reserved.