本文整理匯總了Java中org.greenrobot.greendao.AbstractDao類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractDao類的具體用法?Java AbstractDao怎麽用?Java AbstractDao使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractDao類屬於org.greenrobot.greendao包,在下文中一共展示了AbstractDao類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
musicBeanDaoConfig = daoConfigMap.get(MusicBeanDao.class).clone();
musicBeanDaoConfig.initIdentityScope(type);
searchNameBeanDaoConfig = daoConfigMap.get(SearchNameBeanDao.class).clone();
searchNameBeanDaoConfig.initIdentityScope(type);
videoBeanDaoConfig = daoConfigMap.get(VideoBeanDao.class).clone();
videoBeanDaoConfig.initIdentityScope(type);
musicBeanDao = new MusicBeanDao(musicBeanDaoConfig, this);
searchNameBeanDao = new SearchNameBeanDao(searchNameBeanDaoConfig, this);
videoBeanDao = new VideoBeanDao(videoBeanDaoConfig, this);
registerDao(MusicBean.class, musicBeanDao);
registerDao(SearchNameBean.class, searchNameBeanDao);
registerDao(VideoBean.class, videoBeanDao);
}
示例2: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
tangshiDaoConfig = daoConfigMap.get(TangshiDao.class).clone();
tangshiDaoConfig.initIdentityScope(type);
songCiDaoConfig = daoConfigMap.get(SongCiDao.class).clone();
songCiDaoConfig.initIdentityScope(type);
tangshiDao = new TangshiDao(tangshiDaoConfig, this);
songCiDao = new SongCiDao(songCiDaoConfig, this);
registerDao(Tangshi.class, tangshiDao);
registerDao(SongCi.class, songCiDao);
}
示例3: reflectProperties
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
private static Property[] reflectProperties(Class<? extends AbstractDao<?, ?>> daoClass)
throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException {
Class<?> propertiesClass = Class.forName(daoClass.getName() + "$Properties");
Field[] fields = propertiesClass.getDeclaredFields();
ArrayList<Property> propertyList = new ArrayList<Property>();
final int modifierMask = Modifier.STATIC | Modifier.PUBLIC;
for (Field field : fields) {
// There might be other fields introduced by some tools, just ignore them (see issue #28)
if ((field.getModifiers() & modifierMask) == modifierMask) {
Object fieldValue = field.get(null);
if (fieldValue instanceof Property) {
propertyList.add((Property) fieldValue);
}
}
}
Property[] properties = new Property[propertyList.size()];
for (Property property : propertyList) {
if (properties[property.ordinal] != null) {
throw new DaoException("Duplicate property ordinals");
}
properties[property.ordinal] = property;
}
return properties;
}
示例4: testMockitoMocks
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
@Test
public void testMockitoMocks() {
mock(DaoMaster.class).newSession();
mock(DaoSession.class).getDatabase();
mock(Database.class).getRawDatabase();
mock(DatabaseStatement.class).execute();
mock(IdentityScope.class).clear();
mock(AbstractDao.class).queryBuilder();
mock(MinimalEntityDao.class).queryBuilder();
mock(MinimalEntity.class).getId();
mock(Query.class).forCurrentThread();
mock(QueryBuilder.class).build();
mock(CountQuery.class).forCurrentThread();
mock(DeleteQuery.class).forCurrentThread();
mock(Join.class).getTablePrefix();
mock(LazyList.class).getLoadedCount();
mock(WhereCondition.class).appendValuesTo(null);
mock(Property.class).isNull();
mock(DaoException.class).getMessage();
}
示例5: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
keepEntityDaoConfig = daoConfigMap.get(KeepEntityDao.class).clone();
keepEntityDaoConfig.initIdentityScope(type);
toManyTarget2DaoConfig = daoConfigMap.get(ToManyTarget2Dao.class).clone();
toManyTarget2DaoConfig.initIdentityScope(type);
toOneTarget2DaoConfig = daoConfigMap.get(ToOneTarget2Dao.class).clone();
toOneTarget2DaoConfig.initIdentityScope(type);
relationSource2DaoConfig = daoConfigMap.get(RelationSource2Dao.class).clone();
relationSource2DaoConfig.initIdentityScope(type);
keepEntityDao = new KeepEntityDao(keepEntityDaoConfig, this);
toManyTarget2Dao = new ToManyTarget2Dao(toManyTarget2DaoConfig, this);
toOneTarget2Dao = new ToOneTarget2Dao(toOneTarget2DaoConfig, this);
relationSource2Dao = new RelationSource2Dao(relationSource2DaoConfig, this);
registerDao(KeepEntity.class, keepEntityDao);
registerDao(ToManyTarget2.class, toManyTarget2Dao);
registerDao(ToOneTarget2.class, toOneTarget2Dao);
registerDao(RelationSource2.class, relationSource2Dao);
}
示例6: migrate
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
/**
* 數據遷移
*
* @param db
* @param daoClasses
*/
public void migrate(SQLiteDatabase db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
Database database = new StandardDatabase(db);
logger.log("The Old Database Version " + db.getVersion());
logger.log("Generate temp table start.");
generateTempTables(database, daoClasses);
logger.log("Generate temp table complete.");
dropAllTables(database, true, daoClasses);
createAllTables(database, false, daoClasses);
logger.log("Restore data start.");
restoreData(database, daoClasses);
logger.log("Restore data complete.");
}
示例7: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
isFirstEnterAppDaoConfig = daoConfigMap.get(IsFirstEnterAppDao.class).clone();
isFirstEnterAppDaoConfig.initIdentityScope(type);
userDaoConfig = daoConfigMap.get(UserDao.class).clone();
userDaoConfig.initIdentityScope(type);
isFirstEnterAppDao = new IsFirstEnterAppDao(isFirstEnterAppDaoConfig, this);
userDao = new UserDao(userDaoConfig, this);
registerDao(IsFirstEnterApp.class, isFirstEnterAppDao);
registerDao(User.class, userDao);
}
示例8: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
cityDaoConfig = daoConfigMap.get(CityDao.class).clone();
cityDaoConfig.initIdentityScope(type);
provinceDaoConfig = daoConfigMap.get(ProvinceDao.class).clone();
provinceDaoConfig.initIdentityScope(type);
countyDaoConfig = daoConfigMap.get(CountyDao.class).clone();
countyDaoConfig.initIdentityScope(type);
cityDao = new CityDao(cityDaoConfig, this);
provinceDao = new ProvinceDao(provinceDaoConfig, this);
countyDao = new CountyDao(countyDaoConfig, this);
registerDao(City.class, cityDao);
registerDao(Province.class, provinceDao);
registerDao(County.class, countyDao);
}
示例9: generateTempTables
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
/**
* 生成臨時表,存儲舊的表數據
* @param db
* @param daoClasses
*/
private static void generateTempTables(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
//方法2
for (int i=0;i<daoClasses.length;i++){
DaoConfig daoConfig = new DaoConfig(db,daoClasses[i]);
String tableName = daoConfig.tablename;
if (!checkTable(db,tableName))
continue;
String tempTableName = daoConfig.tablename.concat("_TEMP");
StringBuilder insertTableStringBuilder = new StringBuilder();
insertTableStringBuilder.append("alter table ")
.append(tableName)
.append(" rename to ")
.append(tempTableName)
.append(";");
db.execSQL(insertTableStringBuilder.toString());
}
}
示例10: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
bannerDaoConfig = daoConfigMap.get(BannerDao.class).clone();
bannerDaoConfig.initIdentityScope(type);
orderDaoConfig = daoConfigMap.get(OrderDao.class).clone();
orderDaoConfig.initIdentityScope(type);
sceneDaoConfig = daoConfigMap.get(SceneDao.class).clone();
sceneDaoConfig.initIdentityScope(type);
bannerDao = new BannerDao(bannerDaoConfig, this);
orderDao = new OrderDao(orderDaoConfig, this);
sceneDao = new SceneDao(sceneDaoConfig, this);
registerDao(Banner.class, bannerDao);
registerDao(Order.class, orderDao);
registerDao(Scene.class, sceneDao);
}
示例11: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
audioInfoDaoConfig = daoConfigMap.get(AudioInfoDao.class).clone();
audioInfoDaoConfig.initIdentityScope(type);
videoFileDaoConfig = daoConfigMap.get(VideoFileDao.class).clone();
videoFileDaoConfig.initIdentityScope(type);
videoInfoDaoConfig = daoConfigMap.get(VideoInfoDao.class).clone();
videoInfoDaoConfig.initIdentityScope(type);
audioInfoDao = new AudioInfoDao(audioInfoDaoConfig, this);
videoFileDao = new VideoFileDao(videoFileDaoConfig, this);
videoInfoDao = new VideoInfoDao(videoInfoDaoConfig, this);
registerDao(AudioInfo.class, audioInfoDao);
registerDao(VideoFile.class, videoFileDao);
registerDao(VideoInfo.class, videoInfoDao);
}
示例12: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
shoppingListDaoConfig = daoConfigMap.get(ShoppingListDao.class).clone();
shoppingListDaoConfig.initIdentityScope(type);
productDaoConfig = daoConfigMap.get(ProductDao.class).clone();
productDaoConfig.initIdentityScope(type);
usedProductDaoConfig = daoConfigMap.get(UsedProductDao.class).clone();
usedProductDaoConfig.initIdentityScope(type);
statisticDaoConfig = daoConfigMap.get(StatisticDao.class).clone();
statisticDaoConfig.initIdentityScope(type);
shoppingListDao = new ShoppingListDao(shoppingListDaoConfig, this);
productDao = new ProductDao(productDaoConfig, this);
usedProductDao = new UsedProductDao(usedProductDaoConfig, this);
statisticDao = new StatisticDao(statisticDaoConfig, this);
registerDao(ShoppingList.class, shoppingListDao);
registerDao(Product.class, productDao);
registerDao(UsedProduct.class, usedProductDao);
registerDao(Statistic.class, statisticDao);
}
示例13: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
bpmDaoConfig = daoConfigMap.get(BpmDao.class).clone();
bpmDaoConfig.initIdentityScope(type);
sMSDaoConfig = daoConfigMap.get(SMSDao.class).clone();
sMSDaoConfig.initIdentityScope(type);
bpmDao = new BpmDao(bpmDaoConfig, this);
sMSDao = new SMSDao(sMSDaoConfig, this);
registerDao(Bpm.class, bpmDao);
registerDao(SMS.class, sMSDao);
}
示例14: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
partDaoConfig = daoConfigMap.get(PartDao.class).clone();
partDaoConfig.initIdentityScope(type);
wordBeanDaoConfig = daoConfigMap.get(WordBeanDao.class).clone();
wordBeanDaoConfig.initIdentityScope(type);
partDao = new PartDao(partDaoConfig, this);
wordBeanDao = new WordBeanDao(wordBeanDaoConfig, this);
registerDao(Part.class, partDao);
registerDao(WordBean.class, wordBeanDao);
}
示例15: DaoSession
import org.greenrobot.greendao.AbstractDao; //導入依賴的package包/類
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
noteFileDaoConfig = daoConfigMap.get(NoteFileDao.class).clone();
noteFileDaoConfig.initIdentityScope(type);
notebookDaoConfig = daoConfigMap.get(NotebookDao.class).clone();
notebookDaoConfig.initIdentityScope(type);
noteDaoConfig = daoConfigMap.get(NoteDao.class).clone();
noteDaoConfig.initIdentityScope(type);
userInfoDaoConfig = daoConfigMap.get(UserInfoDao.class).clone();
userInfoDaoConfig.initIdentityScope(type);
noteFileDao = new NoteFileDao(noteFileDaoConfig, this);
notebookDao = new NotebookDao(notebookDaoConfig, this);
noteDao = new NoteDao(noteDaoConfig, this);
userInfoDao = new UserInfoDao(userInfoDaoConfig, this);
registerDao(NoteFile.class, noteFileDao);
registerDao(Notebook.class, notebookDao);
registerDao(Note.class, noteDao);
registerDao(UserInfo.class, userInfoDao);
}