com.j256.ormlite.android.DatabaseTableConfigUtil Java Examples

The following examples show how to use com.j256.ormlite.android.DatabaseTableConfigUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModuleDatabase.java    From AndroidStarter with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: OrmLiteProvider.java    From android-atleap with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: SqliteAndroidDatabaseType.java    From ormlite-android with ISC License 4 votes vote down vote up
@Override
public <T> DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz)
		throws SQLException {
	return DatabaseTableConfigUtil.fromClass(connectionSource, clazz);
}