• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DatabaseTableConfigUtil类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.j256.ormlite.android.DatabaseTableConfigUtil的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTableConfigUtil类的具体用法?Java DatabaseTableConfigUtil怎么用?Java DatabaseTableConfigUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DatabaseTableConfigUtil类属于com.j256.ormlite.android包,在下文中一共展示了DatabaseTableConfigUtil类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: provideDAORepo

点赞 3

import com.j256.ormlite.android.DatabaseTableConfigUtil; //导入依赖的package包/类
@Provides
@Singleton
public DAORepo provideDAORepo(@NonNull final DatabaseHelperAndroidStarter poDatabaseHelperAndroidStarter) {
    try {
        final ConnectionSource loConnectionSource = poDatabaseHelperAndroidStarter.getConnectionSource();
        final DatabaseTableConfig<RepoEntity> loTableConfig = DatabaseTableConfigUtil.fromClass(loConnectionSource, RepoEntity.class);
        if (loTableConfig != null) {
            return new DAORepo(loConnectionSource, loTableConfig);
        } else {
            return new DAORepo(loConnectionSource);
        }
    } catch (final SQLException loException) {
        if (BuildConfig.DEBUG && DEBUG) {
            Logger.t(TAG).e(loException, "");
        }
    }
    return null;
}
 

开发者ID:RoRoche,
项目名称:AndroidStarter,
代码行数:19,
代码来源:ModuleDatabase.java

示例2: getDao

点赞 3

import com.j256.ormlite.android.DatabaseTableConfigUtil; //导入依赖的package包/类
/**
 * This method obtains a DAO given its Class
 * <p/>
 * Source: https://goo.gl/6LIYy2
 *
 * @param clazz
 *         The DAO class
 * @param <D>
 *         DAO super class
 * @param <T>
 *         Requested DAO class
 *
 * @return The DAO instance
 *
 * @throws SQLException
 */
public <D extends Dao<T, ?>, T> D getDao(Class<T> clazz) throws SQLException {
  // lookup the dao, possibly invoking the cached database config
  Dao<T, ?> dao = DaoManager.lookupDao(connectionSource, clazz);
  if (dao == null) {
    // try to use our new reflection magic
    DatabaseTableConfig<T> tableConfig = DatabaseTableConfigUtil
            .fromClass(connectionSource, clazz);
    if (tableConfig == null) {
      /**
       * Note: We have to do this to get to see if they are using the deprecated
       * annotations like
       * {@link DatabaseFieldSimple}.
       */
      dao = (Dao<T, ?>) DaoManager.createDao(connectionSource, clazz);
    } else {
      dao = (Dao<T, ?>) DaoManager.createDao(connectionSource, tableConfig);
    }
  }

  @SuppressWarnings("unchecked")
  D castDao = (D) dao;
  return castDao;
}
 

开发者ID:aajn88,
项目名称:wakemeapp,
代码行数:40,
代码来源:DatabaseHelper.java

示例3: getDatabaseTableConfig

点赞 2

import com.j256.ormlite.android.DatabaseTableConfigUtil; //导入依赖的package包/类
protected DatabaseTableConfig getDatabaseTableConfig(Class clazz) {
    DatabaseTableConfig config = mTableConfigs.get(clazz);
    if (config == null) {
        try {
            config = DatabaseTableConfigUtil.fromClass(mDatabaseHelper.getConnectionSource(), clazz);
            config.extractFieldTypes(mDatabaseHelper.getConnectionSource());
        } catch (SQLException ex) {
            Log.e(TAG, "Cannot get table config", ex);
        }
        if (config != null) {
            mTableConfigs.put(clazz, config);
        }
    }
    return config;
}
 

开发者ID:blandware,
项目名称:android-atleap,
代码行数:16,
代码来源:OrmLiteProvider.java

示例4: extractDatabaseTableConfig

点赞 2

import com.j256.ormlite.android.DatabaseTableConfigUtil; //导入依赖的package包/类
public <T> DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource paramConnectionSource, Class<T> paramClass)
{
  return DatabaseTableConfigUtil.fromClass(paramConnectionSource, paramClass);
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:5,
代码来源:SqliteAndroidDatabaseType.java

示例5: extractDatabaseTableConfig

点赞 2

import com.j256.ormlite.android.DatabaseTableConfigUtil; //导入依赖的package包/类
@Override
public <T> DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz)
		throws SQLException {
	return DatabaseTableConfigUtil.fromClass(connectionSource, clazz);
}
 

开发者ID:j256,
项目名称:ormlite-android,
代码行数:6,
代码来源:SqliteAndroidDatabaseType.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)