use of com.j256.ormlite.dao.DaoManager in project ormlite-android by j256.
the class OrmLiteSqliteOpenHelper method getRuntimeExceptionDao.
/**
* Get a RuntimeExceptionDao for our class. This uses the {@link DaoManager} to cache the DAO for future gets.
*
* <p>
* NOTE: This routing does not return RuntimeExceptionDao<T, ID> because of casting issues if we are assigning
* it to a custom DAO. Grumble.
* </p>
*/
public <D extends RuntimeExceptionDao<T, ?>, T> D getRuntimeExceptionDao(Class<T> clazz) {
try {
Dao<T, ?> dao = getDao(clazz);
@SuppressWarnings({ "unchecked", "rawtypes" }) D castDao = (D) new RuntimeExceptionDao(dao);
return castDao;
} catch (SQLException e) {
throw new RuntimeException("Could not create RuntimeExcepitionDao for class " + clazz, e);
}
}
Aggregations