|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.j256.ormlite.field.FieldType
public class FieldType
Per field information configured from the DatabaseField annotation and the associated Field in the
class. Use the createFieldType(com.j256.ormlite.db.DatabaseType, java.lang.String, java.lang.reflect.Field) static method to instantiate the class.
| Field Summary | |
|---|---|
static String |
FOREIGN_ID_FIELD_SUFFIX
default suffix added to fields that are id fields of foreign objects |
| Constructor Summary | |
|---|---|
FieldType(DatabaseType databaseType,
String tableName,
Field field,
DatabaseFieldConfig fieldConfig)
You should use createFieldType(com.j256.ormlite.db.DatabaseType, java.lang.String, java.lang.reflect.Field) to instantiate one of these field if you have a Field. |
|
| Method Summary | ||
|---|---|---|
void |
assignField(Object data,
Object val)
Assign to the data object the val corresponding to the fieldType. |
|
Object |
assignIdValue(Object data,
Number val)
Assign an ID value to this field. |
|
static FieldType |
createFieldType(DatabaseType databaseType,
String tableName,
Field field)
Return An instantiated FieldType or null if the field does not have a DatabaseField annotation. |
|
Enum<?> |
enumFromInt(Integer val)
Get the Enum associated with the integer value. |
|
Enum<?> |
enumFromString(String val)
Get the Enum associated with the String value. |
|
boolean |
escapeDefaultValue()
Return whether this field's default value should be escaped in SQL. |
|
|
getConvertedFieldValue(Object object)
Return the value from the field in the object after it has been converted to something suitable to be stored in the database. |
|
String |
getDbColumnName()
Return the column name either specified my DatabaseField.columnName() or from Field.getName(). |
|
Object |
getDefaultValue()
Return the default value configured by DatabaseField.defaultValue() or null if none. |
|
String |
getFieldName()
Return the column name either specified my DatabaseField.columnName() or from Field.getName(). |
|
|
getFieldValue(Object object)
Return the value from the field in the object that is defined by this FieldType. |
|
TableInfo<?> |
getForeignTableInfo()
Return the TableInfo associated with the foreign object if the DatabaseField.foreign() annotation
was set to true or null if none. |
|
String |
getGeneratedIdSequence()
Return the generated-id-sequence associated with the field or null if isGeneratedIdSequence() is false. |
|
JdbcType |
getJdbcType()
Return the JdbcType associated with this. |
|
int |
getJdbcTypeVal()
Return the JDBC type value. |
|
int |
getWidth()
Return the width of the field as configured by DatabaseField.width(). |
|
boolean |
isCanBeNull()
Return whether the field can be assigned to null as configured by DatabaseField.canBeNull(). |
|
boolean |
isForeign()
Return whether or not the field is a foreign object field. |
|
boolean |
isGeneratedId()
Return whether the field is a generated-id field. |
|
boolean |
isGeneratedIdSequence()
Return whether the field is a generated-id-sequence field. |
|
boolean |
isId()
Return whether the field is an id field. |
|
boolean |
isNumber()
Return whether this field is a number. |
|
boolean |
isThrowIfNull()
|
|
Object |
parseDefaultString(String defaulStr)
Convert the default value string into a valid Java object for this type. |
|
|
resultToJava(Results results,
Map<String,Integer> columnPositions)
Get the result object from the results. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String FOREIGN_ID_FIELD_SUFFIX
| Constructor Detail |
|---|
public FieldType(DatabaseType databaseType,
String tableName,
Field field,
DatabaseFieldConfig fieldConfig)
throws SQLException
createFieldType(com.j256.ormlite.db.DatabaseType, java.lang.String, java.lang.reflect.Field) to instantiate one of these field if you have a Field.
SQLException| Method Detail |
|---|
public String getFieldName()
DatabaseField.columnName() or from Field.getName().
public String getDbColumnName()
DatabaseField.columnName() or from Field.getName().
public JdbcType getJdbcType()
JdbcType associated with this.
public int getJdbcTypeVal()
public Object getDefaultValue()
DatabaseField.defaultValue() or null if none.
public int getWidth()
DatabaseField.width().
public boolean isCanBeNull()
DatabaseField.canBeNull().
public boolean isId()
DatabaseField.id(),
DatabaseField.generatedId(), OR DatabaseField.generatedIdSequence() are enabled.
public boolean isGeneratedId()
DatabaseField.generatedId() OR
DatabaseField.generatedIdSequence() are enabled.
public boolean isGeneratedIdSequence()
DatabaseField.generatedIdSequence() is specified OR if DatabaseField.generatedId() is enabled and the
DatabaseType.isIdSequenceNeeded() is enabled. If the latter is true then the sequence name will be
auto-generated.
public String getGeneratedIdSequence()
isGeneratedIdSequence() is false.
public boolean isForeign()
public TableInfo<?> getForeignTableInfo()
TableInfo associated with the foreign object if the DatabaseField.foreign() annotation
was set to true or null if none.
public Object parseDefaultString(String defaulStr)
throws SQLException
SQLException
public void assignField(Object data,
Object val)
throws SQLException
SQLException
public Object assignIdValue(Object data,
Number val)
throws SQLException
SQLException
public <FV> FV getFieldValue(Object object)
throws SQLException
SQLException
public <FV> FV getConvertedFieldValue(Object object)
throws SQLException
SQLExceptionpublic boolean isThrowIfNull()
public boolean isNumber()
public boolean escapeDefaultValue()
public <T> T resultToJava(Results results,
Map<String,Integer> columnPositions)
throws SQLException
FieldConverter.resultToJava(com.j256.ormlite.field.FieldType, com.j256.ormlite.support.Results, int).
SQLException
public Enum<?> enumFromInt(Integer val)
throws SQLException
SQLException
public Enum<?> enumFromString(String val)
throws SQLException
SQLException
public static FieldType createFieldType(DatabaseType databaseType,
String tableName,
Field field)
throws SQLException
FieldType or null if the field does not have a DatabaseField annotation.
SQLExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||