Interface ITypeMapping
- All Known Implementing Classes:
AbstractTypeMapping
,DelegatingTypeMapping
public interface ITypeMapping
Mapping of single values to and from the database.
- Since:
- 2.0
- Author:
- Eike Stepper, Stefan Winkler
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A descriptor which describes one type mapping class.static interface
A factory for typeMappings.static interface
A provider for type mapping information.static interface
A global (singleton) registry which collects all available type mappings which are either available in the CDO core, as declared extensions, or registered manually. -
Method Summary
Modifier and TypeMethodDescriptionvoid
createDBField
(org.eclipse.net4j.db.ddl.IDBTable table) Deprecated.void
createDBField
(org.eclipse.net4j.db.ddl.IDBTable table, String fieldName) Creates the DBField and adds it to the given table.org.eclipse.net4j.db.DBType
org.eclipse.net4j.db.ddl.IDBField
getField()
Read the value from aResultSet
and convert it from the DB to the CDO representation.void
readValueToRevision
(ResultSet resultSet, InternalCDORevision revision) Read a value from aResultSet
, convert it from the DB to the CDO representation and set it to the feature of the revision.void
setDBField
(org.eclipse.net4j.db.ddl.IDBTable table, String fieldName) Sets the DBField.void
setDBType
(org.eclipse.net4j.db.DBType dbType) void
setDefaultValue
(PreparedStatement stmt, int index) Set the feature's default value to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method.void
setFeature
(EStructuralFeature feature) void
setMappingStrategy
(IMappingStrategy mappingStrategy) void
setValue
(PreparedStatement stmt, int index, Object value) Set the given value to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method.void
setValueFromRevision
(PreparedStatement stmt, int index, InternalCDORevision value) Set a value of the given revision to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method.
-
Method Details
-
getFeature
EStructuralFeature getFeature()- Returns:
- The feature which is associated with this mapping.
-
getField
org.eclipse.net4j.db.ddl.IDBField getField()- Returns:
- The db field which is associated with this mapping.
-
getDBType
org.eclipse.net4j.db.DBType getDBType()- Returns:
- The db type which is associated with this mapping.
- Since:
- 3.0
-
setMappingStrategy
- Since:
- 4.0
-
setFeature
- Since:
- 4.0
-
setDBType
void setDBType(org.eclipse.net4j.db.DBType dbType) - Since:
- 4.0
-
createDBField
Deprecated.As of 4.2 usecreateDBField(IDBTable, String)
. -
createDBField
Creates the DBField and adds it to the given table. The name of the DBField is explicitly determined by the corresponding parameter.- Parameters:
table
- the table to add this field to.fieldName
- the name for the DBField.
-
setDBField
Sets the DBField. The name of the DBField is explicitly determined by the corresponding parameter.- Parameters:
table
- the table to add this field to.fieldName
- the name for the DBField.- Since:
- 3.0
-
setValue
Set the given value to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method.- Parameters:
stmt
- the prepared statement to set the valueindex
- the index to use for thesetXxx
method.value
- the value to set.- Throws:
SQLException
- if thesetXxx
throws it.
-
setDefaultValue
Set the feature's default value to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method.- Parameters:
stmt
- the prepared statement to set the valueindex
- the index to use for thesetXxx
method.- Throws:
SQLException
- if thesetXxx
throws it.- Since:
- 3.0
-
setValueFromRevision
void setValueFromRevision(PreparedStatement stmt, int index, InternalCDORevision value) throws SQLException Set a value of the given revision to the JDBCIDBPreparedStatement
using an appropriatesetXxx
method. The feature from which the value is taken is determined bygetFeature()
.- Parameters:
stmt
- the prepared statement to set the valueindex
- the index to use for thesetXxx
method.value
- the revision to get the value to set from.- Throws:
SQLException
- if thesetXxx
throws it.
-
readValue
Read the value from aResultSet
and convert it from the DB to the CDO representation. The resultSet field to read from is determined automatically by the internalgetField()
name.- Parameters:
resultSet
- the result set to read from- Returns:
- the read value
- Throws:
SQLException
- if reading the value throws an SQLException- Since:
- 3.0
-
readValueToRevision
Read a value from aResultSet
, convert it from the DB to the CDO representation and set it to the feature of the revision. The feature is determined by getFeature() The resultSet field to read from is determined automatically by the internalgetField()
name.- Parameters:
resultSet
- the result set to read fromrevision
- the revision to which the value should be set.- Throws:
SQLException
- if reading the value throws an SQLException- Since:
- 3.0
-
createDBField(IDBTable, String)
.