当前位置: 首页>>代码示例>>Java>>正文


Java FieldType.isGeneratedId方法代码示例

本文整理汇总了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");
    }
}
 
开发者ID:blandware,项目名称:android-atleap,代码行数:29,代码来源:OrmLiteProvider.java

示例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());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:9,代码来源:MappedCreate.java

示例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());
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:29,代码来源:BaseDatabaseType.java

示例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");
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:10,代码来源:BaseSqliteDatabaseType.java

示例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++;
    }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:40,代码来源:TableInfo.java


注:本文中的com.j256.ormlite.field.FieldType.isGeneratedId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。