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

B32476-03

oracle.toplink.mappings.foundation
Class AbstractDirectMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
      extended by oracle.toplink.mappings.foundation.AbstractDirectMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DirectToFieldMapping, EISDirectMapping, XMLDirectMapping

public abstract class AbstractDirectMapping
extends DatabaseMapping

Purpose: Maps an attribute to the corresponding database field type. The list of field types that are supported by TopLink's direct to field mapping is dependent on the relational database being used. A converter can be used to convert between the object and data type if they do not match.

Since:
TopLink/Java 1.0
See Also:
Converter, ObjectTypeConverter, TypeConversionConverter, SerializedObjectConverter, Serialized Form

Constructor Summary
AbstractDirectMapping()
          Default constructor.
 
Method Summary
 java.lang.Class getAttributeClassification()
          Some databases do not properly support all of the base data types.
 Converter getConverter()
          Return the converter on the mapping.
 java.lang.Class getFieldClassification()
          ADVANCED: Return the class type of the field value.
 java.lang.String getFieldName()
          Name of the field this mapping represents.
 java.lang.Object getNullValue()
          Allow for the value used for null to be specified.
 boolean hasConverter()
          Indicates if the mapping has a converter set on it.
 boolean isMutable()
          Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced.
 void setAttributeClassification(java.lang.Class attributeClassification)
          Some databases do not properly support all of the base data types.
 void setConverter(Converter converter)
          Set the converter on the mapping.
 void setConverterClassName(java.lang.String converterClassName)
          Guy Set the converter class name on the mapping.
 void setField(DatabaseField theField)
          ADVANCED: Set the field in the mapping.
 void setFieldClassification(java.lang.Class fieldType)
          ADVANCED: Set the class type of the field value.
 void setFieldType(int jdbcType)
          ADVANCED: Set the JDBC type of the field value.
 void setIsMutable(boolean isMutable)
          Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced.
 void setNullValue(java.lang.Object nullValue)
          Allow for the value used for null to be specified.
 
Methods inherited from class oracle.toplink.mappings.DatabaseMapping
getAttributeAccessor, 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

AbstractDirectMapping

public AbstractDirectMapping()
Default constructor.

Method Detail

getConverter

public Converter getConverter()
Return the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.


setConverter

public void setConverter(Converter converter)
Set the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.


setConverterClassName

public void setConverterClassName(java.lang.String converterClassName)
Guy Set the converter class name on the mapping. It will be instantiated during the convertClassNamesToClasses. A converter can be used to convert between the object's value and database value of the attribute.


isMutable

public boolean isMutable()
Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced. This is false by default unless a mutable converter is used such as the SerializedObjectConverter. This can be set to false in this case, or if a Calendar or byte[] is desired to be used as a mutable value it can be set to true.


setIsMutable

public void setIsMutable(boolean isMutable)
Return true if the attribute for this mapping is a simple atomic value that cannot be modified, only replaced. This is false by default unless a mutable converter is used such as the SerializedObjectConverter. This can be set to false in this case, or if a Calendar or byte[] is desired to be used as a mutable value it can be set to true.


getAttributeClassification

public java.lang.Class getAttributeClassification()
Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell TopLink to force the instance variable value to that data type

Overrides:
getAttributeClassification in class DatabaseMapping

getFieldClassification

public java.lang.Class getFieldClassification()
ADVANCED: Return the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar.


setFieldClassification

public void setFieldClassification(java.lang.Class fieldType)
ADVANCED: Set the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar. This must be called after the field name has been set.


setFieldType

public void setFieldType(int jdbcType)
ADVANCED: Set the JDBC type of the field value. This can be used if field type does not corespond directly to a Java class type, such as MONEY. This is used for binding.


getFieldName

public java.lang.String getFieldName()
Name of the field this mapping represents.


getNullValue

public java.lang.Object getNullValue()
Allow for the value used for null to be specified. This can be used to convert database null values to application specific values, when null values are not allowed by the application (such as in primitives). Note: the default value for NULL is used on reads, writes, and query SQL generation


hasConverter

public boolean hasConverter()
Indicates if the mapping has a converter set on it.

Returns:
true if there is a converter set on the mapping, null otherwise.

setAttributeClassification

public void setAttributeClassification(java.lang.Class attributeClassification)
Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell TopLink to force the instance variable value to that data type


setField

public void setField(DatabaseField theField)
ADVANCED: Set the field in the mapping. This can be used for advanced field types, such as XML nodes, or to set the field type.


setNullValue

public void setNullValue(java.lang.Object nullValue)
Allow for the value used for null to be specified. This can be used to convert database null values to application specific values, when null values are not allowed by the application (such as in primitives). Note: the default value for NULL is used on reads, writes, and query SQL generation


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