com.j256.ormlite.field.types
Class IntegerObjectType

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.IntegerObjectType
All Implemented Interfaces:
DataPersister, FieldConverter
Direct Known Subclasses:
IntType

public class IntegerObjectType
extends BaseDataType

Type that persists a Integer object.

Author:
graywatson

Constructor Summary
protected IntegerObjectType(SqlType sqlType, Class<?>[] classes)
           
 
Method Summary
 Object convertIdNumber(Number number)
          Convert a Number object to its primitive object suitable for assigning to an ID field.
static IntegerObjectType getSingleton()
           
 boolean isEscapedValue()
          Return whether we need to escape this value in SQL expressions.
 boolean isValidForVersion()
          Return true if this is a valid field for the DatabaseField.version().
 boolean isValidGeneratedType()
          Return true if this type can be auto-generated by the database.
 Object moveToNextValue(Object currentValue)
          Move the current-value to the next value.
 Object parseDefaultString(FieldType fieldType, String defaultStr)
          Convert a default string object and return the appropriate argument to a SQL insert or update statement.
 Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos)
          Return the SQL argument object extracted from the results associated with column in position columnPos.
 
Methods inherited from class com.j256.ormlite.field.types.BaseDataType
dataIsEqual, generateId, getAssociatedClasses, getAssociatedClassNames, getDefaultWidth, getPrimaryClass, getSqlType, isAppropriateId, isArgumentHolderRequired, isComparable, isEscapedDefaultValue, isPrimitive, isSelfGeneratedId, isValidForField, makeConfigObject, resultStringToJava
 
Methods inherited from class com.j256.ormlite.field.BaseFieldConverter
isStreamType, javaToSqlArg, resultToJava, sqlArgToJava
 
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, javaToSqlArg, resultToJava, sqlArgToJava
 

Constructor Detail

IntegerObjectType

protected IntegerObjectType(SqlType sqlType,
                            Class<?>[] classes)
Method Detail

getSingleton

public static IntegerObjectType getSingleton()

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.

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

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.

Specified by:
resultToSqlArg in interface FieldConverter
Specified by:
resultToSqlArg in class BaseDataType
Parameters:
fieldType - Associated FieldType which may be null.
Throws:
SQLException - If there is a problem accessing the results data.

convertIdNumber

public Object convertIdNumber(Number number)
Description copied from interface: DataPersister
Convert a Number object to its primitive object suitable for assigning to an ID field.

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

isEscapedValue

public boolean isEscapedValue()
Description copied from interface: DataPersister
Return whether we need to escape this value in SQL expressions. Numbers _must_ not be escaped but most other values should be.

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

isValidGeneratedType

public boolean isValidGeneratedType()
Description copied from interface: DataPersister
Return true if this type can be auto-generated by the database. Probably only numbers will return true.

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

isValidForVersion

public boolean isValidForVersion()
Description copied from interface: DataPersister
Return true if this is a valid field for the DatabaseField.version().

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

moveToNextValue

public Object moveToNextValue(Object currentValue)
Description copied from interface: DataPersister
Move the current-value to the next value. Used for the version field.

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


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