|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<JdbcType>
com.j256.ormlite.field.JdbcType
public enum JdbcType
JDBC type enumeration to provide Java class to/from JDBC 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
Links the Types.BOOLEAN SQL type and the boolean primitive. |
|
BOOLEAN_OBJ
Links the Types.BOOLEAN SQL type and the Boolean Java class. |
|
BYTE
Links the Types.TINYINT SQL type and the byte primitive. |
|
BYTE_OBJ
Links the Types.TINYINT SQL type and the Byte Java class. |
|
DOUBLE
Links the Types.DOUBLE SQL type and the double primitive. |
|
DOUBLE_OBJ
Links the Types.DOUBLE SQL type and the Double Java class. |
|
ENUM_INTEGER
Links the Types.INTEGER SQL type and the Enum Java class. |
|
ENUM_STRING
Links the Types.VARCHAR SQL type and the Enum Java class. |
|
FLOAT
Links the Types.FLOAT SQL type and the float primitive. |
|
FLOAT_OBJ
Links the Types.FLOAT SQL type and the Float Java class. |
|
INTEGER
Links the Types.INTEGER SQL type and the int primitive. |
|
INTEGER_OBJ
Links the Types.INTEGER SQL type and the Integer Java class. |
|
JAVA_DATE
Links the Types.TIMESTAMP SQL type and the Date Java class. |
|
LONG
Links the Types.BIGINT SQL type and the long primitive. |
|
LONG_OBJ
Links the Types.BIGINT SQL type and the Long Java class. |
|
SERIALIZABLE
Links the Types.VARBINARY SQL type and an unknown Java Object that is serializable. |
|
SHORT
Links the Types.SMALLINT SQL type and the short primitive. |
|
SHORT_OBJ
Links the Types.SMALLINT SQL type and the Short Java class. |
|
STRING
Links the Types.VARCHAR SQL type and the String Java class. |
|
UNKNOWN
Marker for fields that are unknown. |
|
| Method Summary | |
|---|---|
Object |
convertIdNumber(Number number)
Convert a Number object to its primitive object suitable for assigning to an ID field. |
boolean |
escapeDefaultValue()
Return whether this field's default value should be escaped in SQL. |
int |
getJdbcTypeVal()
Return the SQL type that is stored in the database for this argument. |
boolean |
isNumber()
Return whether this field is a number. |
boolean |
isPrimitive()
Return whether this field is a primitive type or not. |
boolean |
isStreamType()
Return whether or not this is a SQL "stream" object. |
boolean |
isValidForType(Class<?> fieldClass)
Return true if the fieldClass is appropriate for this enum. |
boolean |
isValidGeneratedType()
Return true if this type can be auto-generated by the database. |
Object |
javaToArg(Object javaObject)
Convert a Java object and return the appropriate argument to a SQL insert or update statement. |
static JdbcType |
lookupClass(Class<?> dataClass)
Static method that returns the JdbcType associated with the class argument or UNKNOWN if not
found. |
static JdbcType |
lookupIdTypeVal(int typeVal)
Static method that returns the JdbcType associated with the SQL type value or UNKNOWN if
UNKNOWN not found. |
abstract Object |
parseDefaultString(String defaultStr)
Convert a default string object and return the appropriate argument to a SQL insert or update statement. |
Number |
resultToId(Results results,
int columnPos)
Return the object suitable to be set on an id field that was extracted from the results associated with column in position columnPos. |
abstract Object |
resultToJava(FieldType fieldType,
Results results,
int columnPos)
Return the object extracted from the results associated with column in position columnPos. |
static JdbcType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static JdbcType[] |
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 JdbcType STRING
Types.VARCHAR SQL type and the String Java class.
public static final JdbcType BOOLEAN
Types.BOOLEAN SQL type and the boolean primitive.
public static final JdbcType BOOLEAN_OBJ
Types.BOOLEAN SQL type and the Boolean Java class.
public static final JdbcType JAVA_DATE
Types.TIMESTAMP SQL type and the Date Java class.
NOTE: This is not the same as the Date class.
public static final JdbcType BYTE
Types.TINYINT SQL type and the byte primitive.
public static final JdbcType BYTE_OBJ
Types.TINYINT SQL type and the Byte Java class.
public static final JdbcType SHORT
Types.SMALLINT SQL type and the short primitive.
public static final JdbcType SHORT_OBJ
Types.SMALLINT SQL type and the Short Java class.
public static final JdbcType INTEGER
Types.INTEGER SQL type and the int primitive.
public static final JdbcType INTEGER_OBJ
Types.INTEGER SQL type and the Integer Java class.
public static final JdbcType LONG
Types.BIGINT SQL type and the long primitive.
public static final JdbcType LONG_OBJ
Types.BIGINT SQL type and the Long Java class.
public static final JdbcType FLOAT
Types.FLOAT SQL type and the float primitive.
public static final JdbcType FLOAT_OBJ
Types.FLOAT SQL type and the Float Java class.
public static final JdbcType DOUBLE
Types.DOUBLE SQL type and the double primitive.
public static final JdbcType DOUBLE_OBJ
Types.DOUBLE SQL type and the Double Java class.
public static final JdbcType SERIALIZABLE
Types.VARBINARY SQL type and an unknown Java Object that is serializable.
public static final JdbcType ENUM_STRING
Types.VARCHAR SQL type and the Enum Java class. You can also specify the ENUM_INTEGER
as the JdbcType.
public static final JdbcType ENUM_INTEGER
Types.INTEGER SQL type and the Enum Java class. You can also specify the ENUM_STRING
as the JdbcType.
public static final JdbcType UNKNOWN
| Method Detail |
|---|
public static JdbcType[] values()
for (JdbcType c : JdbcType.values()) System.out.println(c);
public static JdbcType 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 null
public abstract Object resultToJava(FieldType fieldType,
Results results,
int columnPos)
throws SQLException
FieldConverter
resultToJava in interface FieldConverterSQLException - If there is a problem accessing the results data.
public abstract Object parseDefaultString(String defaultStr)
throws SQLException
FieldConverter
parseDefaultString in interface FieldConverterSQLException
public Object javaToArg(Object javaObject)
throws SQLException
FieldConverter
javaToArg in interface FieldConverterSQLExceptionpublic int getJdbcTypeVal()
FieldConverterTypes
constants.
getJdbcTypeVal in interface FieldConverterpublic boolean isValidGeneratedType()
public Object convertIdNumber(Number number)
Number object to its primitive object suitable for assigning to an ID field.
public Number resultToId(Results results,
int columnPos)
throws SQLException
SQLExceptionpublic boolean isValidForType(Class<?> fieldClass)
public static JdbcType lookupClass(Class<?> dataClass)
JdbcType associated with the class argument or UNKNOWN if not
found.
public static JdbcType lookupIdTypeVal(int typeVal)
JdbcType associated with the SQL type value or UNKNOWN if
UNKNOWN not found.
public boolean escapeDefaultValue()
public boolean isNumber()
public boolean isPrimitive()
public boolean isStreamType()
FieldConverter
isStreamType in interface FieldConverter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||