com.j256.ormlite.field.types
Class SqlDateType

java.lang.Object
  extended by com.j256.ormlite.field.BaseFieldConverter
      extended by com.j256.ormlite.field.types.BaseDataType
          extended by com.j256.ormlite.field.types.BaseDateType
              extended by com.j256.ormlite.field.types.DateType
                  extended by com.j256.ormlite.field.types.SqlDateType
All Implemented Interfaces:
DataPersister, FieldConverter

public class SqlDateType
extends DateType

Type that persists a Date object.

NOTE: This is not the same as the Date class handled with DateType. If it recommended that you use the other Date class which is more standard to Java programs.

Author:
graywatson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.j256.ormlite.field.types.BaseDateType
BaseDateType.DateStringFormatConfig
 
Field Summary
 
Fields inherited from class com.j256.ormlite.field.types.BaseDateType
defaultDateFormatConfig
 
Constructor Summary
protected SqlDateType(SqlType sqlType, Class<?>[] classes)
          Here for others to subclass.
 
Method Summary
protected  BaseDateType.DateStringFormatConfig getDefaultDateFormatConfig()
          Return the default date format configuration.
static SqlDateType getSingleton()
           
 boolean isValidForField(Field field)
          Return true if the field is appropriate for this persister otherwise false.
 Object javaToSqlArg(FieldType fieldType, Object javaObject)
          Convert a Java 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 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.types.DateType
isArgumentHolderRequired, parseDefaultString, resultToSqlArg
 
Methods inherited from class com.j256.ormlite.field.types.BaseDateType
convertDateStringConfig, isValidForVersion, moveToNextValue, normalizeDateString, parseDateString
 
Methods inherited from class com.j256.ormlite.field.types.BaseDataType
convertIdNumber, dataIsEqual, generateId, getAssociatedClasses, getAssociatedClassNames, getDefaultWidth, getPrimaryClass, getSqlType, isAppropriateId, isComparable, isEscapedDefaultValue, isEscapedValue, isPrimitive, isSelfGeneratedId, isValidGeneratedType, makeConfigObject
 
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
 
Methods inherited from interface com.j256.ormlite.field.FieldConverter
isStreamType, resultToJava
 

Constructor Detail

SqlDateType

protected SqlDateType(SqlType sqlType,
                      Class<?>[] classes)
Here for others to subclass.

Method Detail

getSingleton

public static SqlDateType getSingleton()

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.

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

javaToSqlArg

public Object javaToSqlArg(FieldType fieldType,
                           Object javaObject)
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 DateType

getDefaultDateFormatConfig

protected BaseDateType.DateStringFormatConfig getDefaultDateFormatConfig()
Description copied from class: DateType
Return the default date format configuration.

Overrides:
getDefaultDateFormatConfig in class DateType

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.

Specified by:
resultStringToJava in interface FieldConverter
Overrides:
resultStringToJava in class BaseDataType

isValidForField

public boolean isValidForField(Field field)
Description copied from interface: DataPersister
Return true if the field is appropriate for this persister otherwise false.

Specified by:
isValidForField in interface DataPersister
Overrides:
isValidForField in class BaseDateType


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