|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<DataType>
com.j256.ormlite.field.DataType
public enum DataType
Data type enumeration to provide Java class to/from database mapping.
NOTE: If you add types here you will need to add to the various DatabaseType implementors' appendColumnArg() method.
Here's a good page about the mapping for a number of database types:
Enum Constant Summary | |
---|---|
BOOLEAN
Persists the boolean Java primitive. |
|
BOOLEAN_OBJ
Persists the Boolean Java class. |
|
BYTE
Persists the byte primitive. |
|
BYTE_ARRAY
Persists the byte[] array type. |
|
BYTE_OBJ
Persists the Byte Java class. |
|
CHAR
Persists the char primitive. |
|
CHAR_OBJ
Persists the char primitive. |
|
DATE
Persists the Date Java class. |
|
DATE_LONG
Persists the Date Java class as long milliseconds since epoch. |
|
DATE_STRING
Persists the Date Java class as a string of a format. |
|
DOUBLE
Persists the double primitive. |
|
DOUBLE_OBJ
Persists the Double Java class. |
|
ENUM_INTEGER
Persists an Enum Java class as its ordinal interger value. |
|
ENUM_STRING
Persists an Enum Java class as its string value. |
|
FLOAT
Persists the float primitive. |
|
FLOAT_OBJ
Persists the Float Java class. |
|
INTEGER
Persists the int primitive. |
|
INTEGER_OBJ
Persists the Integer Java class. |
|
JAVA_DATE
Deprecated. You should use DATE |
|
JAVA_DATE_LONG
Deprecated. You should use DATE_LONG |
|
JAVA_DATE_STRING
Deprecated. You should use DATE_STRING |
|
LONG
Persists the long primitive. |
|
LONG_OBJ
Persists the Long Java class. |
|
LONG_STRING
Persists the String Java class. |
|
SERIALIZABLE
Persists an unknown Java Object that is serializable. |
|
SHORT
Persists the short primitive. |
|
SHORT_OBJ
Persists the Short Java class. |
|
STRING
Persists the String Java class. |
|
STRING_BYTES
Persists the String Java class. |
|
UNKNOWN
Marker for fields that are unknown. |
|
UUID
Persists the UUID Java class. |
Field Summary | |
---|---|
static com.j256.ormlite.field.DataType.DateStringFormatConfig |
defaultDateFormatConfig
|
Method Summary | |
---|---|
Object |
generatedId()
Return a generated id if appropriate or null if none. |
SqlType |
getSqlType()
Return the SQL type that is stored in the database for this argument. |
boolean |
isSelfGeneratedId()
Return true if this type creates its own generated ids else false to have the database do it. |
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. |
static DataType |
lookupClass(Class<?> dataClass)
Static method that returns the DataType associated with the class argument or UNKNOWN if not found. |
Object |
makeConfigObject(FieldType fieldType)
This makes a configuration object for the data-type or returns null if none. |
abstract Object |
parseDefaultString(FieldType fieldType,
String defaultStr)
Convert a default string object and return the appropriate argument to a SQL insert or update statement. |
abstract Object |
resultToJava(FieldType fieldType,
DatabaseResults results,
int columnPos)
Return the object extracted from the results associated with column in position columnPos. |
static DataType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static DataType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final DataType STRING
String
Java class.
public static final DataType LONG_STRING
String
Java class.
public static final DataType STRING_BYTES
String
Java class.
public static final DataType BOOLEAN
public static final DataType BOOLEAN_OBJ
Boolean
Java class.
public static final DataType DATE
Date
Java class.
NOTE: This is not the same as the Date
class.
@Deprecated public static final DataType JAVA_DATE
DATE
public static final DataType DATE_LONG
Date
Java class as long milliseconds since epoch.
NOTE: This is not the same as the Date
class.
@Deprecated public static final DataType JAVA_DATE_LONG
DATE_LONG
public static final DataType DATE_STRING
Date
Java class as a string of a format.
NOTE: This is not the same as the Date
class.
WARNING: Because of SimpleDateFormat not being reentrant, this has to do some synchronization with every data in/out unfortunately.
@Deprecated public static final DataType JAVA_DATE_STRING
DATE_STRING
public static final DataType CHAR
public static final DataType CHAR_OBJ
public static final DataType BYTE
public static final DataType BYTE_ARRAY
public static final DataType BYTE_OBJ
Byte
Java class.
public static final DataType SHORT
public static final DataType SHORT_OBJ
Short
Java class.
public static final DataType INTEGER
public static final DataType INTEGER_OBJ
Integer
Java class.
public static final DataType LONG
public static final DataType LONG_OBJ
Long
Java class.
public static final DataType FLOAT
public static final DataType FLOAT_OBJ
Float
Java class.
public static final DataType DOUBLE
public static final DataType DOUBLE_OBJ
Double
Java class.
public static final DataType SERIALIZABLE
public static final DataType ENUM_STRING
ENUM_INTEGER
as the type.
public static final DataType ENUM_INTEGER
ENUM_STRING
as the
type.
public static final DataType UUID
UUID
Java class.
public static final DataType UNKNOWN
Field Detail |
---|
public static final com.j256.ormlite.field.DataType.DateStringFormatConfig defaultDateFormatConfig
Method Detail |
---|
public static DataType[] values()
for (DataType c : DataType.values()) System.out.println(c);
public static DataType valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static DataType lookupClass(Class<?> dataClass) throws SQLException
UNKNOWN
if not found.
SQLException
public abstract Object resultToJava(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException
FieldConverter
resultToJava
in interface FieldConverter
fieldType
- Associated FieldType which may be null.
SQLException
- If there is a problem accessing the results data.public abstract Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException
FieldConverter
parseDefaultString
in interface FieldConverter
SQLException
public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException
FieldConverter
javaToSqlArg
in interface FieldConverter
SQLException
public Object makeConfigObject(FieldType fieldType) throws SQLException
FieldType.getDataTypeConfigObj()
.
SQLException
public SqlType getSqlType()
FieldConverter
getSqlType
in interface FieldConverter
public boolean isStreamType()
FieldConverter
isStreamType
in interface FieldConverter
public boolean isSelfGeneratedId()
public Object generatedId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |