|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sormula.translator.AbstractColumnTranslator<R,T> org.sormula.translator.AbstractBlobColumnTranslator<R,T>
R
- row classT
- type of field that is stored as SQL BLOB typepublic abstract class AbstractBlobColumnTranslator<R,T>
Base class for creating custom column translators for fields stored as SQL BLOB.
Translates a field using PreparedStatement.setBlob(int, Blob)
and
ResultSet.getBlob(int)
. Implement blobToField(Blob)
and fieldToBlob(Object)
to create a blob column translator for type T in row type R. AbstractColumnTranslator
is
the base class. See BlobExample and WidgetColumnTranslator2 for example of how
to use this class.
Constructor Summary | |
---|---|
AbstractBlobColumnTranslator(java.lang.reflect.Field field,
java.lang.String columnName)
See super class constructor for description. |
Method Summary | |
---|---|
protected abstract T |
blobToField(java.sql.Blob blob)
Converts a Blob object to a domain object for use by read(ResultSet, int, Object) . |
protected abstract java.sql.Blob |
fieldToBlob(T field)
Converts a domain object to a Blob for use by write(PreparedStatement, int, Object) . |
void |
read(java.sql.ResultSet resultSet,
int columnIndex,
R row)
Reads column value from result set and sets in row object. |
void |
write(java.sql.PreparedStatement preparedStatement,
int parameterIndex,
R row)
Gets column value from row and sets as parameter in prepared statement. |
Methods inherited from class org.sormula.translator.AbstractColumnTranslator |
---|
getColumnName, getField, getSormulaField, getTypeTranslator, isIdentity, newInstance, setIdentity, setTypeTranslator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractBlobColumnTranslator(java.lang.reflect.Field field, java.lang.String columnName) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public void write(java.sql.PreparedStatement preparedStatement, int parameterIndex, R row) throws java.lang.Exception
write
in interface ColumnTranslator<R>
write
in class AbstractColumnTranslator<R,T>
preparedStatement
- set column value as parameter in this statementparameterIndex
- set parameter at this indexrow
- get value from this row
java.lang.Exception
- if errorpublic void read(java.sql.ResultSet resultSet, int columnIndex, R row) throws java.lang.Exception
read
in interface ColumnTranslator<R>
read
in class AbstractColumnTranslator<R,T>
resultSet
- read column from this result setcolumnIndex
- read value at this column index from result setrow
- set value in this row
java.lang.Exception
- if errorprotected abstract java.sql.Blob fieldToBlob(T field) throws java.lang.Exception
Blob
for use by write(PreparedStatement, int, Object)
.
Implement this method in a subclass to write type T that to database as a BLOB column type.
field
- domain object that is stored in database as SQL BLOB type
java.lang.Exception
- if errorprotected abstract T blobToField(java.sql.Blob blob) throws java.lang.Exception
Blob
object to a domain object for use by read(ResultSet, int, Object)
.
Implement this method in a subclass to read type T from database as a BLOB column type.
blob
- JDBC blob
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |