本文整理汇总了Java中io.realm.RealmQuery.createQuery方法的典型用法代码示例。如果您正苦于以下问题:Java RealmQuery.createQuery方法的具体用法?Java RealmQuery.createQuery怎么用?Java RealmQuery.createQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.realm.RealmQuery
的用法示例。
在下文中一共展示了RealmQuery.createQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryDatabaseMasterAll
import io.realm.RealmQuery; //导入方法依赖的package包/类
/**
* Query the master table in the database for all rows
*
* @param <T> T extends RealmModel
* @return returns a list of Objects that was pulled from the DB. If nothing found,
* it will return an initialized, but empty, list.
*/
private <T extends RealmModel> List<MasterDatabaseObject> queryDatabaseMasterAll() {
Realm realm = DatabaseUtilities.buildRealm(this.realmConfiguration);
RealmQuery query = RealmQuery.createQuery(realm, MasterDatabaseObject.class);
//Start transaction
RealmResults<T> results = query.findAll();
if (results.size() <= 0) {
return new ArrayList<>();
}
try {
List<MasterDatabaseObject> masterDatabaseObjectList = new ArrayList<MasterDatabaseObject>();
for (T t : results) {
if (t != null) {
MasterDatabaseObject mdo = (MasterDatabaseObject) t;
if (!StringUtilities.isNullOrEmpty(mdo.getId()) &&
!StringUtilities.isNullOrEmpty(mdo.getJsonString())) {
masterDatabaseObjectList.add(mdo);
}
}
}
return masterDatabaseObjectList;
} catch (Exception e) {
return new ArrayList<>();
}
}
示例2: DogQueryBuilder2
import io.realm.RealmQuery; //导入方法依赖的package包/类
public DogQueryBuilder2(Realm realm) {
this.query = RealmQuery.createQuery(realm, Dog.class);
}
示例3: buildRealmQuery
import io.realm.RealmQuery; //导入方法依赖的package包/类
/**
* If no query is set, this will build a query with the class sent in
*
* @param realm
* @param myClass
* @return
*/
private RealmQuery buildRealmQuery(Realm realm, Class myClass) {
RealmQuery query = RealmQuery.createQuery(realm, myClass);
return query;
}