Klasse AbstractTypeMapping
java.lang.Object
org.eclipse.emf.cdo.server.db.mapping.AbstractTypeMapping
- Alle implementierten Schnittstellen:
ITypeMapping
This is a default implementation for the
ITypeMapping interface which provides default behavor for all common
types. Implementors should provide a constructor which the factory (see below) can use and implement
getResultSetValue(ResultSet). If needed, doSetValue(PreparedStatement, int, Object) can also be
overridden as a counterpart to getResultSetValue(ResultSet). Finally, an implementor should also implement a
suitable factory for the TypeMappingRegistry and register it either manually using
IManagedContainer.registerFactory(org.eclipse.net4j.util.factory.IFactory) or using the Net4j Extension Point
factories.- Seit:
- 4.0
- Autor:
- Eike Stepper, Stefan Winkler
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen org.eclipse.emf.cdo.server.db.mapping.ITypeMapping
ITypeMapping.Descriptor, ITypeMapping.Factory, ITypeMapping.Provider, ITypeMapping.Registry -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungfinal voidcreateDBField(org.eclipse.net4j.db.ddl.IDBTable table) Veraltet.final voidcreateDBField(org.eclipse.net4j.db.ddl.IDBTable table, String fieldName) Creates the DBField and adds it to the given table.protected voiddoSetValue(PreparedStatement stmt, int index, Object value) Implementors could override this method to convert a given value to the database representation and set it to the prepared statement.protected intgetDBLength(org.eclipse.net4j.db.DBType type) org.eclipse.net4j.db.DBTypeprotected Objectfinal EStructuralFeaturefinal org.eclipse.net4j.db.ddl.IDBFieldgetField()final IMappingStrategyprotected abstract ObjectgetResultSetValue(ResultSet resultSet) Subclasses should implement this method to read the value from the result set.protected final ObjectgetRevisionValue(InternalCDORevision revision) protected intReturns the SQL type of this TypeMapping.final ObjectRead the value from aResultSetand convert it from the DB to the CDO representation.final voidreadValueToRevision(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.final voidsetDBField(org.eclipse.net4j.db.ddl.IDBTable table, String fieldName) Sets the DBField.final voidsetDBType(org.eclipse.net4j.db.DBType dbType) final voidsetDefaultValue(PreparedStatement stmt, int index) Set the feature's default value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.final voidsetFeature(EStructuralFeature feature) final voidsetMappingStrategy(IMappingStrategy mappingStrategy) final voidsetValue(PreparedStatement stmt, int index, Object value) Set the given value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.final voidsetValueFromRevision(PreparedStatement stmt, int index, InternalCDORevision revision) Set a value of the given revision to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.toString()
-
Konstruktordetails
-
AbstractTypeMapping
public AbstractTypeMapping()Create a new type mapping
-
-
Methodendetails
-
getMappingStrategy
-
setMappingStrategy
- Angegeben von:
setMappingStrategyin SchnittstelleITypeMapping
-
getFeature
- Angegeben von:
getFeaturein SchnittstelleITypeMapping- Gibt zurück:
- The feature which is associated with this mapping.
-
setFeature
- Angegeben von:
setFeaturein SchnittstelleITypeMapping
-
setDBType
public final void setDBType(org.eclipse.net4j.db.DBType dbType) - Angegeben von:
setDBTypein SchnittstelleITypeMapping
-
getDBType
public org.eclipse.net4j.db.DBType getDBType()- Angegeben von:
getDBTypein SchnittstelleITypeMapping- Gibt zurück:
- The db type which is associated with this mapping.
-
setValueFromRevision
public final void setValueFromRevision(PreparedStatement stmt, int index, InternalCDORevision revision) throws SQLException Beschreibung aus Schnittstelle kopiert:ITypeMappingSet a value of the given revision to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod. The feature from which the value is taken is determined byITypeMapping.getFeature().- Angegeben von:
setValueFromRevisionin SchnittstelleITypeMapping- Parameter:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.revision- the revision to get the value to set from.- Löst aus:
SQLException- if thesetXxxthrows it.
-
setDefaultValue
Beschreibung aus Schnittstelle kopiert:ITypeMappingSet the feature's default value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.- Angegeben von:
setDefaultValuein SchnittstelleITypeMapping- Parameter:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.- Löst aus:
SQLException- if thesetXxxthrows it.
-
setValue
Beschreibung aus Schnittstelle kopiert:ITypeMappingSet the given value to the JDBCIDBPreparedStatementusing an appropriatesetXxxmethod.- Angegeben von:
setValuein SchnittstelleITypeMapping- Parameter:
stmt- the prepared statement to set the valueindex- the index to use for thesetXxxmethod.value- the value to set.- Löst aus:
SQLException- if thesetXxxthrows it.
-
createDBField
Veraltet.- Angegeben von:
createDBFieldin SchnittstelleITypeMapping
-
createDBField
Beschreibung aus Schnittstelle kopiert:ITypeMappingCreates the DBField and adds it to the given table. The name of the DBField is explicitly determined by the corresponding parameter.- Angegeben von:
createDBFieldin SchnittstelleITypeMapping- Parameter:
table- the table to add this field to.fieldName- the name for the DBField.
-
getField
public final org.eclipse.net4j.db.ddl.IDBField getField()- Angegeben von:
getFieldin SchnittstelleITypeMapping- Gibt zurück:
- The db field which is associated with this mapping.
-
setDBField
Beschreibung aus Schnittstelle kopiert:ITypeMappingSets the DBField. The name of the DBField is explicitly determined by the corresponding parameter.- Angegeben von:
setDBFieldin SchnittstelleITypeMapping- Parameter:
table- the table to add this field to.fieldName- the name for the DBField.
-
readValueToRevision
public final void readValueToRevision(ResultSet resultSet, InternalCDORevision revision) throws SQLException Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
readValueToRevisionin SchnittstelleITypeMapping- Parameter:
resultSet- the result set to read fromrevision- the revision to which the value should be set.- Löst aus:
SQLException- if reading the value throws an SQLException
-
readValue
Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
readValuein SchnittstelleITypeMapping- Parameter:
resultSet- the result set to read from- Gibt zurück:
- the read value
- Löst aus:
SQLException- if reading the value throws an SQLException
-
toString
-
getDefaultValue
-
getRevisionValue
-
doSetValue
Implementors could override this method to convert a given value to the database representation and set it to the prepared statement.- Parameter:
stmt- theIDBPreparedStatementwhich is used for DB accessindex- the parameter index in the statement which should be setvalue- the value of the feature which should be written into the DB- Löst aus:
SQLException
-
getSqlType
protected int getSqlType()Returns the SQL type of this TypeMapping. The default implementation considers the type map held by themeta-data manager. Subclasses may override.- Gibt zurück:
- The sql type of this TypeMapping.
-
getDBLength
protected int getDBLength(org.eclipse.net4j.db.DBType type) -
getResultSetValue
Subclasses should implement this method to read the value from the result set. Typical implementations should look similar to this one:resultSet.getString(getField().getName())- Parameter:
resultSet- the result set to read from- Gibt zurück:
- the result value read (this has to be compatible with the
feature. - Löst aus:
SQLException
-