com.j256.ormlite.db
Class BaseDatabaseType.BooleanNumberFieldConverter

java.lang.Object
  extended by com.j256.ormlite.field.BaseFieldConverter
      extended by com.j256.ormlite.db.BaseDatabaseType.BooleanNumberFieldConverter
All Implemented Interfaces:
FieldConverter
Enclosing class:
BaseDatabaseType

protected static class BaseDatabaseType.BooleanNumberFieldConverter
extends BaseFieldConverter

Conversion to/from the Boolean Java field as a number because some databases like the true/false.


Constructor Summary
protected BaseDatabaseType.BooleanNumberFieldConverter()
           
 
Method Summary
 SqlType getSqlType()
          Return the SQL type that is stored in the database for this argument.
 Object javaToSqlArg(FieldType fieldType, Object obj)
          Convert a Java object and return the appropriate argument to a SQL insert or update statement.
 Object parseDefaultString(FieldType fieldType, String defaultStr)
          Convert a default string object and return the appropriate argument to a SQL insert or update statement.
 Object resultStringToJava(FieldType fieldType, String stringValue, int columnPos)
          Convert a string result value to the related Java field.
 Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos)
          Return the SQL argument object extracted from the results associated with column in position columnPos.
 Object sqlArgToJava(FieldType fieldType, Object sqlArg, int columnPos)
          Return the object converted from the SQL arg to java.
 
Methods inherited from class com.j256.ormlite.field.BaseFieldConverter
isStreamType, resultToJava
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseDatabaseType.BooleanNumberFieldConverter

protected BaseDatabaseType.BooleanNumberFieldConverter()
Method Detail

getSqlType

public SqlType getSqlType()
Description copied from interface: FieldConverter
Return the SQL type that is stored in the database for this argument.


parseDefaultString

public Object parseDefaultString(FieldType fieldType,
                                 String defaultStr)
Description copied from interface: FieldConverter
Convert a default string object and return the appropriate argument to a SQL insert or update statement.


javaToSqlArg

public Object javaToSqlArg(FieldType fieldType,
                           Object obj)
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
Overrides:
javaToSqlArg in class BaseFieldConverter

resultToSqlArg

public Object resultToSqlArg(FieldType fieldType,
                             DatabaseResults results,
                             int columnPos)
                      throws SQLException
Description copied from interface: FieldConverter
Return the SQL argument object extracted from the results associated with column in position columnPos. For example, if the type is a date-long then this will return a long value or null.

Parameters:
fieldType - Associated FieldType which may be null.
Throws:
SQLException - If there is a problem accessing the results data.

sqlArgToJava

public Object sqlArgToJava(FieldType fieldType,
                           Object sqlArg,
                           int columnPos)
Description copied from interface: FieldConverter
Return the object converted from the SQL arg to java. This takes the database representation and converts it into a Java object. For example, if the type is a date-long then this will take a long which is stored in the database and return a Date.

Specified by:
sqlArgToJava in interface FieldConverter
Overrides:
sqlArgToJava in class BaseFieldConverter
Parameters:
fieldType - Associated FieldType which may be null.
sqlArg - SQL argument converted with FieldConverter.resultToSqlArg(FieldType, DatabaseResults, int) which will not be null.

resultStringToJava

public Object resultStringToJava(FieldType fieldType,
                                 String stringValue,
                                 int columnPos)
Description copied from interface: FieldConverter
Convert a string result value to the related Java field.



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