Class DelegatingTypeMapping
- java.lang.Object
-
- org.eclipse.emf.cdo.server.db.mapping.DelegatingTypeMapping
-
- All Implemented Interfaces:
ITypeMapping
public abstract class DelegatingTypeMapping extends java.lang.Object implements ITypeMapping
- Since:
- 4.10
- Author:
- Eike Stepper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emf.cdo.server.db.mapping.ITypeMapping
ITypeMapping.Descriptor, ITypeMapping.Factory, ITypeMapping.Provider, ITypeMapping.Registry
-
-
Constructor Summary
Constructors Constructor Description DelegatingTypeMapping()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcreateDBField(org.eclipse.net4j.db.ddl.IDBTable table)voidcreateDBField(org.eclipse.net4j.db.ddl.IDBTable table, java.lang.String fieldName)Creates the DBField and adds it to the given table.protected java.lang.Objectdecode(java.lang.Object value)protected java.lang.Objectencode(java.lang.Object value)org.eclipse.net4j.db.DBTypegetDBType()abstract AbstractTypeMappinggetDelegate()org.eclipse.emf.ecore.EStructuralFeaturegetFeature()org.eclipse.net4j.db.ddl.IDBFieldgetField()java.lang.ObjectreadValue(java.sql.ResultSet resultSet)Read the value from aResultSetand convert it from the DB to the CDO representation.voidreadValueToRevision(java.sql.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.voidsetDBField(org.eclipse.net4j.db.ddl.IDBTable table, java.lang.String fieldName)Sets the DBField.voidsetDBType(org.eclipse.net4j.db.DBType dbType)voidsetDefaultValue(java.sql.PreparedStatement stmt, int index)Set the feature's default value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.voidsetFeature(org.eclipse.emf.ecore.EStructuralFeature feature)voidsetMappingStrategy(IMappingStrategy mappingStrategy)voidsetValue(java.sql.PreparedStatement stmt, int index, java.lang.Object value)Set the given value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.voidsetValueFromRevision(java.sql.PreparedStatement stmt, int index, InternalCDORevision revision)Set a value of the given revision to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.
-
-
-
Method Detail
-
getDelegate
public abstract AbstractTypeMapping getDelegate()
-
getFeature
public org.eclipse.emf.ecore.EStructuralFeature getFeature()
- Specified by:
getFeaturein interfaceITypeMapping- Returns:
- The feature which is associated with this mapping.
-
getField
public org.eclipse.net4j.db.ddl.IDBField getField()
- Specified by:
getFieldin interfaceITypeMapping- Returns:
- The db field which is associated with this mapping.
-
getDBType
public org.eclipse.net4j.db.DBType getDBType()
- Specified by:
getDBTypein interfaceITypeMapping- Returns:
- The db type which is associated with this mapping.
-
setMappingStrategy
public void setMappingStrategy(IMappingStrategy mappingStrategy)
- Specified by:
setMappingStrategyin interfaceITypeMapping
-
setFeature
public void setFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
- Specified by:
setFeaturein interfaceITypeMapping
-
setDBType
public void setDBType(org.eclipse.net4j.db.DBType dbType)
- Specified by:
setDBTypein interfaceITypeMapping
-
createDBField
public void createDBField(org.eclipse.net4j.db.ddl.IDBTable table)
- Specified by:
createDBFieldin interfaceITypeMapping
-
createDBField
public void createDBField(org.eclipse.net4j.db.ddl.IDBTable table, java.lang.String fieldName)Description copied from interface:ITypeMappingCreates the DBField and adds it to the given table. The name of the DBField is explicitly determined by the corresponding parameter.- Specified by:
createDBFieldin interfaceITypeMapping- Parameters:
table- the table to add this field to.fieldName- the name for the DBField.
-
setDBField
public void setDBField(org.eclipse.net4j.db.ddl.IDBTable table, java.lang.String fieldName)Description copied from interface:ITypeMappingSets the DBField. The name of the DBField is explicitly determined by the corresponding parameter.- Specified by:
setDBFieldin interfaceITypeMapping- Parameters:
table- the table to add this field to.fieldName- the name for the DBField.
-
setValue
public void setValue(java.sql.PreparedStatement stmt, int index, java.lang.Object value) throws java.sql.SQLExceptionDescription copied from interface:ITypeMappingSet the given value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.- Specified by:
setValuein interfaceITypeMapping- Parameters:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.value- the value to set.- Throws:
java.sql.SQLException- if thesetXxxthrows it.
-
setDefaultValue
public void setDefaultValue(java.sql.PreparedStatement stmt, int index) throws java.sql.SQLExceptionDescription copied from interface:ITypeMappingSet the feature's default value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.- Specified by:
setDefaultValuein interfaceITypeMapping- Parameters:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.- Throws:
java.sql.SQLException- if thesetXxxthrows it.
-
setValueFromRevision
public void setValueFromRevision(java.sql.PreparedStatement stmt, int index, InternalCDORevision revision) throws java.sql.SQLExceptionDescription copied from interface:ITypeMappingSet a value of the given revision to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod. The feature from which the value is taken is determined byITypeMapping.getFeature().- Specified by:
setValueFromRevisionin interfaceITypeMapping- Parameters:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.revision- the revision to get the value to set from.- Throws:
java.sql.SQLException- if thesetXxxthrows it.
-
readValue
public java.lang.Object readValue(java.sql.ResultSet resultSet) throws java.sql.SQLExceptionDescription copied from interface:ITypeMappingRead the value from aResultSetand convert it from the DB to the CDO representation. The resultSet field to read from is determined automatically by the internalITypeMapping.getField()name.- Specified by:
readValuein interfaceITypeMapping- Parameters:
resultSet- the result set to read from- Returns:
- the read value
- Throws:
java.sql.SQLException- if reading the value throws an SQLException
-
readValueToRevision
public void readValueToRevision(java.sql.ResultSet resultSet, InternalCDORevision revision) throws java.sql.SQLExceptionDescription copied from interface:ITypeMappingRead 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 internalITypeMapping.getField()name.- Specified by:
readValueToRevisionin interfaceITypeMapping- Parameters:
resultSet- the result set to read fromrevision- the revision to which the value should be set.- Throws:
java.sql.SQLException- if reading the value throws an SQLException
-
encode
protected java.lang.Object encode(java.lang.Object value)
-
decode
protected java.lang.Object decode(java.lang.Object value)
-
-