|
||||||||||
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.support.ConnectionSource, java.lang.String, java.lang.reflect.Field, java.lang.Class>)
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 |
static int |
MAX_FOREIGN_RECURSE_LEVEL
|
Constructor Summary | |
---|---|
FieldType(ConnectionSource connectionSource,
String tableName,
Field field,
DatabaseFieldConfig fieldConfig,
Class<?> parentClass)
You should use createFieldType(com.j256.ormlite.support.ConnectionSource, java.lang.String, java.lang.reflect.Field, java.lang.Class>) 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. |
|
|
buildForeignCollection(Object id)
Build and return a foreign collection based on the field settings that matches the id argument. |
|
|
convertJavaFieldToSqlArgValue(Object fieldVal)
Convert a field value to something suitable to be stored in the database. |
|
static FieldType |
createFieldType(ConnectionSource connectionSource,
String tableName,
Field field,
Class<?> parentClass)
Return An instantiated FieldType or null if the field does not have a DatabaseField annotation. |
|
boolean |
equals(Object arg)
|
|
Object |
extractJavaFieldToSqlArgValue(Object object)
Extract a field from an object and convert to something suitable to be passed to SQL as an argument. |
|
|
extractJavaFieldValue(Object object)
Return the value from the field in the object that is defined by this FieldType. |
|
Object |
generatedId()
Call through to DataType.generatedId() |
|
DataType |
getDataType()
|
|
Object |
getDataTypeConfigObj()
|
|
String |
getDbColumnName()
|
|
Object |
getDefaultValue()
|
|
String |
getFieldName()
|
|
Class<?> |
getFieldType()
|
|
|
getFieldValueIfNotDefault(Object object)
Return the value of field in the data argument if it is not the default value for the class. |
|
FieldType |
getForeignIdField()
Return the id field associated with the foreign object or null if none. |
|
String |
getGeneratedIdSequence()
Return the generated-id-sequence associated with the field or null if isGeneratedIdSequence() is false. |
|
String |
getIndexName()
|
|
SqlType |
getSqlType()
|
|
String |
getTableName()
|
|
String |
getUniqueIndexName()
|
|
int |
getWidth()
|
|
int |
hashCode()
|
|
boolean |
isCanBeNull()
|
|
boolean |
isComparable()
Call through to DataType.isComparable() |
|
boolean |
isEscapedDefaultValue()
Call through to DataType.isEscapedDefaultValue() |
|
boolean |
isEscapedValue()
Call through to DataType.isEscapedValue() |
|
boolean |
isForeign()
|
|
boolean |
isForeignCollection()
Call through to DatabaseFieldConfig.isForeignCollection() |
|
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 |
isSelectArgRequired()
Call through to DataType.isSelectArgRequired() |
|
boolean |
isSelfGeneratedId()
Call through to DataType.isSelfGeneratedId() |
|
boolean |
isUnique()
|
|
boolean |
isUniqueCombo()
|
|
|
resultToJava(DatabaseResults results,
Map<String,Integer> columnPositions)
Get the result object from the results. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String FOREIGN_ID_FIELD_SUFFIX
public static final int MAX_FOREIGN_RECURSE_LEVEL
Constructor Detail |
---|
public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException
createFieldType(com.j256.ormlite.support.ConnectionSource, java.lang.String, java.lang.reflect.Field, java.lang.Class>)
to instantiate one of these field if you have a Field
.
SQLException
Method Detail |
---|
public String getTableName()
public String getFieldName()
public Class<?> getFieldType()
public String getDbColumnName()
public DataType getDataType()
public Object getDataTypeConfigObj()
public SqlType getSqlType()
public Object getDefaultValue()
public int getWidth()
public boolean isCanBeNull()
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 void assignField(Object data, Object val) throws SQLException
SQLException
public Object assignIdValue(Object data, Number val) throws SQLException
SQLException
public <FV> FV extractJavaFieldValue(Object object) throws SQLException
SQLException
public Object extractJavaFieldToSqlArgValue(Object object) throws SQLException
SQLException
public <FV> FV convertJavaFieldToSqlArgValue(Object fieldVal) throws SQLException
SQLException
public FieldType getForeignIdField() throws SQLException
SQLException
public boolean isEscapedValue()
DataType.isEscapedValue()
public boolean isUnique()
public boolean isUniqueCombo()
public String getIndexName()
public String getUniqueIndexName()
public boolean isEscapedDefaultValue()
DataType.isEscapedDefaultValue()
public boolean isComparable()
DataType.isComparable()
public boolean isSelectArgRequired()
DataType.isSelectArgRequired()
public boolean isForeignCollection()
DatabaseFieldConfig.isForeignCollection()
public <FT,FID> BaseForeignCollection<FT,FID> buildForeignCollection(Object id) throws SQLException
SQLException
public <T> T resultToJava(DatabaseResults results, Map<String,Integer> columnPositions) throws SQLException
FieldConverter.resultToJava(com.j256.ormlite.field.FieldType, com.j256.ormlite.support.DatabaseResults, int)
.
SQLException
public boolean isSelfGeneratedId()
DataType.isSelfGeneratedId()
public Object generatedId()
DataType.generatedId()
public <FV> FV getFieldValueIfNotDefault(Object object) throws SQLException
SQLException
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException
FieldType
or null if the field does not have a DatabaseField
annotation.
SQLException
public boolean equals(Object arg)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |