com.j256.ormlite.field
Class BaseFieldConverter

java.lang.Object
  extended by com.j256.ormlite.field.BaseFieldConverter
All Implemented Interfaces:
FieldConverter
Direct Known Subclasses:
BaseDatabaseType.BooleanNumberFieldConverter, BaseDataType

public abstract class BaseFieldConverter
extends Object
implements FieldConverter

Base class for field-converters.

Author:
graywatson

Constructor Summary
BaseFieldConverter()
           
 
Method Summary
 boolean isStreamType()
          Return whether or not this is a SQL "stream" object.
 Object javaToSqlArg(FieldType fieldType, Object javaObject)
          Convert a Java object and return the appropriate argument to a SQL insert or update statement.
 Object resultToJava(FieldType fieldType, DatabaseResults results, int columnPos)
          This is usually just a call that takes the result from FieldConverter.resultToSqlArg(FieldType, DatabaseResults, int) and passes it through FieldConverter.sqlArgToJava(FieldType, Object, int).
 Object sqlArgToJava(FieldType fieldType, Object sqlArg, int columnPos)
          Return the object converted from the SQL arg to java.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.j256.ormlite.field.FieldConverter
getSqlType, parseDefaultString, resultStringToJava, resultToSqlArg
 

Constructor Detail

BaseFieldConverter

public BaseFieldConverter()
Method Detail

javaToSqlArg

public Object javaToSqlArg(FieldType fieldType,
                           Object javaObject)
                    throws SQLException
Description copied from interface: FieldConverter
Convert a Java object and return the appropriate argument to a SQL insert or update statement.

Specified by:
javaToSqlArg in interface FieldConverter
Throws:
SQLException - If there are problems with the conversion.

resultToJava

public Object resultToJava(FieldType fieldType,
                           DatabaseResults results,
                           int columnPos)
                    throws SQLException
Description copied from interface: FieldConverter
This is usually just a call that takes the result from FieldConverter.resultToSqlArg(FieldType, DatabaseResults, int) and passes it through FieldConverter.sqlArgToJava(FieldType, Object, int).

Specified by:
resultToJava in interface FieldConverter
Throws:
SQLException

sqlArgToJava

public Object sqlArgToJava(FieldType fieldType,
                           Object sqlArg,
                           int columnPos)
                    throws SQLException
Description copied from interface: FieldConverter
Return the object converted from the SQL arg to java.

Specified by:
sqlArgToJava in interface FieldConverter
Parameters:
fieldType - Associated FieldType which may be null.
sqlArg - SQL argument converted with FieldConverter.resultToSqlArg(FieldType, DatabaseResults, int) which will not be null.
Throws:
SQLException - If there are problems with the conversion.

isStreamType

public boolean isStreamType()
Description copied from interface: FieldConverter
Return whether or not this is a SQL "stream" object. Cannot get certain stream objects from the SQL results more than once. If true, the converter has to protect itself against null values.

Specified by:
isStreamType in interface FieldConverter


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.