com.j256.ormlite.field.types
Class DateStringType

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

public class DateStringType
extends BaseDateType

Type that persists a Date object as a String.

Author:
graywatson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.j256.ormlite.field.types.BaseDateType
BaseDateType.DateStringFormatConfig
 
Field Summary
static int DEFAULT_WIDTH
           
 
Fields inherited from class com.j256.ormlite.field.types.BaseDateType
defaultDateFormatConfig
 
Method Summary
 int getDefaultWidth()
          Return the default width associated with this type or 0 if none.
static DateStringType getSingleton()
           
 boolean isValidForField(Field field)
          Return true if the field is appropriate for this persister.
 Object javaToSqlArg(FieldType fieldType, Object obj)
          Convert a Java object and return the appropriate argument to a SQL insert or update statement.
 Object makeConfigObject(FieldType fieldType)
          This makes a configuration object for the data-type or returns null if none.
 Object parseDefaultString(FieldType fieldType, String defaultStr)
          Convert a default string object and return the appropriate argument to a SQL insert or update statement.
 Object resultToJava(FieldType fieldType, DatabaseResults results, int columnPos)
          Return the 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.types.BaseDateType
convertDateStringConfig, isValidForVersion, moveToNextValue, normalizeDateString, parseDateString
 
Methods inherited from class com.j256.ormlite.field.types.BaseDataType
convertIdNumber, dataIsEqual, generateId, getAssociatedClasses, getSqlType, isAppropriateId, isArgumentHolderRequired, isComparable, isEscapedDefaultValue, isEscapedValue, isPrimitive, isSelfGeneratedId, isStreamType, isValidGeneratedType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static int DEFAULT_WIDTH
Method Detail

getSingleton

public static DateStringType getSingleton()

parseDefaultString

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

Specified by:
parseDefaultString in interface FieldConverter
Specified by:
parseDefaultString in class BaseDataType
Throws:
SQLException

resultToJava

public Object resultToJava(FieldType fieldType,
                           DatabaseResults results,
                           int columnPos)
                    throws SQLException
Description copied from interface: FieldConverter
Return the object extracted from the results associated with column in position columnPos.

Specified by:
resultToJava in interface FieldConverter
Specified by:
resultToJava in class BaseDataType
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)
                    throws SQLException
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 BaseDataType
Parameters:
fieldType - Associated FieldType which may be null.
Throws:
SQLException - For subclasses.

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 BaseDataType

isValidForField

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

Specified by:
isValidForField in interface DataPersister
Specified by:
isValidForField in class BaseDataType

makeConfigObject

public Object makeConfigObject(FieldType fieldType)
Description copied from interface: DataPersister
This makes a configuration object for the data-type or returns null if none. The object can be accessed later via FieldType.getDataTypeConfigObj().

Specified by:
makeConfigObject in interface DataPersister
Overrides:
makeConfigObject in class BaseDataType

getDefaultWidth

public int getDefaultWidth()
Description copied from interface: DataPersister
Return the default width associated with this type or 0 if none.

Specified by:
getDefaultWidth in interface DataPersister
Overrides:
getDefaultWidth in class BaseDataType


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