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


Java DatabaseTableConfig.extractTableName方法代码示例

本文整理汇总了Java中com.j256.ormlite.table.DatabaseTableConfig.extractTableName方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTableConfig.extractTableName方法的具体用法?Java DatabaseTableConfig.extractTableName怎么用?Java DatabaseTableConfig.extractTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.j256.ormlite.table.DatabaseTableConfig的用法示例。


在下文中一共展示了DatabaseTableConfig.extractTableName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromClass

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource paramConnectionSource, Class<T> paramClass)
{
  DatabaseType localDatabaseType = paramConnectionSource.getDatabaseType();
  String str = DatabaseTableConfig.extractTableName(paramClass);
  ArrayList localArrayList = new ArrayList();
  for (Object localObject = paramClass; localObject != null; localObject = ((Class)localObject).getSuperclass())
  {
    Field[] arrayOfField = ((Class)localObject).getDeclaredFields();
    int i = arrayOfField.length;
    for (int j = 0; j < i; j++)
    {
      DatabaseFieldConfig localDatabaseFieldConfig = configFromField(localDatabaseType, str, arrayOfField[j]);
      if ((localDatabaseFieldConfig != null) && (localDatabaseFieldConfig.isPersisted()))
        localArrayList.add(localDatabaseFieldConfig);
    }
  }
  if (localArrayList.size() == 0)
    return null;
  return new DatabaseTableConfig(paramClass, str, localArrayList);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:DatabaseTableConfigUtil.java

示例2: fromClass

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
/**
 * Build our list table config from a class using some annotation fu around.
 */
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz)
		throws SQLException {
	DatabaseType databaseType = connectionSource.getDatabaseType();
	String tableName = DatabaseTableConfig.extractTableName(clazz);
	List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>();
	for (Class<?> classWalk = clazz; classWalk != null; classWalk = classWalk.getSuperclass()) {
		for (Field field : classWalk.getDeclaredFields()) {
			DatabaseFieldConfig config = configFromField(databaseType, tableName, field);
			if (config != null && config.isPersisted()) {
				fieldConfigs.add(config);
			}
		}
	}
	if (fieldConfigs.size() == 0) {
		return null;
	} else {
		return new DatabaseTableConfig<T>(clazz, tableName, fieldConfigs);
	}
}
 
开发者ID:d-tarasov,项目名称:ormlite-android-sqlcipher,代码行数:23,代码来源:DatabaseTableConfigUtil.java

示例3: writeConfigForTable

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
private static void writeConfigForTable(BufferedWriter writer, Class<?> clazz) throws SQLException, IOException {
    String tableName = DatabaseTableConfig.extractTableName(clazz);
    List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>();
    // walk up the classes finding the fields
    try {
        for (Class<?> working = clazz; working != null; working = working.getSuperclass()) {
            for (Field field : working.getDeclaredFields()) {
                DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field);
                if (fieldConfig != null) {
                    fieldConfigs.add(fieldConfig);
                }
            }
        }
    } catch (Error e) {
        System.err.println("Skipping " + clazz + " because we got an error finding its definition: "
                               + e.getMessage());
        return;
    }
    if (fieldConfigs.isEmpty()) {
        System.out.println("Skipping " + clazz + " because no annotated fields found");
        return;
    }
    @SuppressWarnings({"rawtypes", "unchecked"})
    DatabaseTableConfig<?> tableConfig = new DatabaseTableConfig(clazz, tableName, fieldConfigs);
    DatabaseTableConfigLoader.write(writer, tableConfig);
    writer.append("#################################");
    writer.newLine();
    System.out.println("Wrote config for " + clazz);
}
 
开发者ID:stephanenicolas,项目名称:ormlite-android-gradle-plugin,代码行数:30,代码来源:OrmLiteConfigUtil.java

示例4: addClass

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
/**
 * Add mapping between Uri path and Class of ER model
 * @param path Uri path
 * @param baseType base MIME type.
 * @param subType sub MIME type. See <a href="http://developer.android.com/guide/topics/providers/content-provider-creating.html#TableMIMETypes">Cursor mime types</a>
 * @param clazz class of ER model
 */
public void addClass(String path, SQLiteMatcherEntry.Type baseType, String subType, Class clazz) {
    if (clazz == null) {
        throw new IllegalArgumentException("Class cannot be null");
    }
    String tableName = DatabaseTableConfig.extractTableName(clazz);
    E matcherEntry = createMatcherEntry(path, baseType, subType);
    matcherEntry.setTablesSQL(tableName);
    matcherEntry.setClazz(clazz);
    addMatherEntry(matcherEntry);
}
 
开发者ID:blandware,项目名称:android-atleap,代码行数:18,代码来源:OrmLiteUriMatcher.java

示例5: writeConfigForTable

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
private static void writeConfigForTable(BufferedWriter writer, Class<?> clazz) throws SQLException, IOException {
	String tableName = DatabaseTableConfig.extractTableName(clazz);
	List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>();
	// walk up the classes finding the fields
	try {
		for (Class<?> working = clazz; working != null; working = working.getSuperclass()) {
			for (Field field : working.getDeclaredFields()) {
				DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field);
				if (fieldConfig != null) {
					fieldConfigs.add(fieldConfig);
				}
			}
		}
	} catch (Error e) {
		System.err.println("Skipping " + clazz + " because we got an error finding its definition: "
				+ e.getMessage());
		return;
	}
	if (fieldConfigs.isEmpty()) {
		System.out.println("Skipping " + clazz + " because no annotated fields found");
		return;
	}
	@SuppressWarnings({ "rawtypes", "unchecked" })
	DatabaseTableConfig<?> tableConfig = new DatabaseTableConfig(clazz, tableName, fieldConfigs);
	DatabaseTableConfigLoader.write(writer, tableConfig);
	writer.append("#################################");
	writer.newLine();
	System.out.println("Wrote config for " + clazz);
}
 
开发者ID:d-tarasov,项目名称:ormlite-android-sqlcipher,代码行数:30,代码来源:OrmLiteConfigUtil.java

示例6: writeConfigForTable

import com.j256.ormlite.table.DatabaseTableConfig; //导入方法依赖的package包/类
private static void writeConfigForTable(BufferedWriter paramBufferedWriter, Class<?> paramClass)
{
  String str = DatabaseTableConfig.extractTableName(paramClass);
  ArrayList localArrayList = new ArrayList();
  Object localObject = paramClass;
  if (localObject != null);
  while (true)
  {
    int j;
    try
    {
      Field[] arrayOfField = ((Class)localObject).getDeclaredFields();
      int i = arrayOfField.length;
      j = 0;
      if (j < i)
      {
        Field localField = arrayOfField[j];
        DatabaseFieldConfig localDatabaseFieldConfig = DatabaseFieldConfig.fromField(databaseType, str, localField);
        if (localDatabaseFieldConfig == null)
          break label220;
        localArrayList.add(localDatabaseFieldConfig);
        break label220;
      }
      localObject = ((Class)localObject).getSuperclass();
      break;
    }
    catch (Error localError)
    {
      System.err.println("Skipping " + paramClass + " because we got an error finding its definition: " + localError.getMessage());
      return;
    }
    if (localArrayList.isEmpty())
    {
      System.out.println("Skipping " + paramClass + " because no annotated fields found");
      return;
    }
    DatabaseTableConfigLoader.write(paramBufferedWriter, new DatabaseTableConfig(paramClass, str, localArrayList));
    paramBufferedWriter.append("#################################");
    paramBufferedWriter.newLine();
    System.out.println("Wrote config for " + paramClass);
    return;
    label220: j++;
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:45,代码来源:OrmLiteConfigUtil.java


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