本文整理汇总了Java中com.j256.ormlite.field.FieldType.isGeneratedId方法的典型用法代码示例。如果您正苦于以下问题:Java FieldType.isGeneratedId方法的具体用法?Java FieldType.isGeneratedId怎么用?Java FieldType.isGeneratedId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.field.FieldType
的用法示例。
在下文中一共展示了FieldType.isGeneratedId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdFieldName
import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected String getIdFieldName(SQLiteMatcherEntry entry) {
OrmLiteMatcherEntry ormliteEntry = (OrmLiteMatcherEntry)entry;
if (ormliteEntry.getClazz() == null) {
throw new IllegalStateException("In order to use ITEM type you should fill in class");
}
try {
DatabaseTableConfig config = getDatabaseTableConfig(ormliteEntry.getClazz());
FieldType[] fieldTypes = config.getFieldTypes(mDatabaseHelper.getConnectionSource().getDatabaseType());
FieldType idFieldType = null;
for (FieldType fieldType : fieldTypes) {
if(fieldType.isId() || fieldType.isGeneratedId() || fieldType.isGeneratedIdSequence()) {
idFieldType = fieldType;
}
}
if (idFieldType == null) {
throw new IllegalStateException("Cannot find id field");
}
return idFieldType.getColumnName();
} catch (SQLException ex) {
Log.e(TAG, "Cannot get id field", ex);
throw new IllegalStateException("Cannot find id field");
}
}
示例2: isFieldCreatable
import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
private static boolean isFieldCreatable(DatabaseType paramDatabaseType, FieldType paramFieldType)
{
if (paramFieldType.isForeignCollection())
return false;
if ((paramDatabaseType.isIdSequenceNeeded()) && (paramDatabaseType.isSelectSequenceBeforeInsert()))
return true;
return (!paramFieldType.isGeneratedId()) || (paramFieldType.isSelfGeneratedId()) || (paramFieldType.isAllowGeneratedIdInsert());
}
示例3: addPrimaryKeySql
import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
public void addPrimaryKeySql(FieldType[] paramArrayOfFieldType, List<String> paramList1, List<String> paramList2, List<String> paramList3, List<String> paramList4)
{
Object localObject = null;
int i = paramArrayOfFieldType.length;
for (int j = 0; j < i; j++)
{
FieldType localFieldType = paramArrayOfFieldType[j];
if (((!localFieldType.isGeneratedId()) || (generatedIdSqlAtEnd()) || (localFieldType.isSelfGeneratedId())) && (localFieldType.isId()))
{
if (localObject == null)
{
StringBuilder localStringBuilder = new StringBuilder(48);
localObject = localStringBuilder;
localStringBuilder.append("PRIMARY KEY (");
}
else
{
localObject.append(',');
}
appendEscapedEntityName(localObject, localFieldType.getColumnName());
}
}
if (localObject != null)
{
localObject.append(") ");
paramList1.add(localObject.toString());
}
}
示例4: appendLongType
import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
protected void appendLongType(StringBuilder paramStringBuilder, FieldType paramFieldType, int paramInt)
{
if ((paramFieldType.getSqlType() == SqlType.LONG) && (paramFieldType.isGeneratedId()))
{
paramStringBuilder.append("INTEGER");
return;
}
paramStringBuilder.append("BIGINT");
}
示例5: TableInfo
import com.j256.ormlite.field.FieldType; //导入方法依赖的package包/类
public TableInfo(DatabaseType paramDatabaseType, BaseDaoImpl<T, ID> paramBaseDaoImpl, DatabaseTableConfig<T> paramDatabaseTableConfig)
{
this.baseDaoImpl = paramBaseDaoImpl;
this.dataClass = paramDatabaseTableConfig.getDataClass();
this.tableName = paramDatabaseTableConfig.getTableName();
this.fieldTypes = paramDatabaseTableConfig.getFieldTypes(paramDatabaseType);
Object localObject = null;
boolean bool = false;
int i = 0;
for (FieldType localFieldType2 : this.fieldTypes)
{
if ((localFieldType2.isId()) || (localFieldType2.isGeneratedId()) || (localFieldType2.isGeneratedIdSequence()))
{
if (localObject != null)
throw new SQLException("More than 1 idField configured for class " + this.dataClass + " (" + localObject + "," + localFieldType2 + ")");
localObject = localFieldType2;
}
if (localFieldType2.isForeignAutoCreate())
bool = true;
if (localFieldType2.isForeignCollection())
i++;
}
this.idField = localObject;
this.constructor = paramDatabaseTableConfig.getConstructor();
this.foreignAutoCreate = bool;
if (i == 0)
{
this.foreignCollections = NO_FOREIGN_COLLECTIONS;
return;
}
this.foreignCollections = new FieldType[i];
int m = 0;
for (FieldType localFieldType1 : this.fieldTypes)
if (localFieldType1.isForeignCollection())
{
this.foreignCollections[m] = localFieldType1;
m++;
}
}