本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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++;
}
}