本文整理汇总了Java中io.realm.RealmQuery.contains方法的典型用法代码示例。如果您正苦于以下问题:Java RealmQuery.contains方法的具体用法?Java RealmQuery.contains怎么用?Java RealmQuery.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.realm.RealmQuery
的用法示例。
在下文中一共展示了RealmQuery.contains方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchElephants
import io.realm.RealmQuery; //导入方法依赖的package包/类
private RealmResults<Elephant> searchElephants() {
Elephant e = Parcels.unwrap(getIntent().getParcelableExtra(EXTRA_SEARCH_ELEPHANT));
RealmQuery<Elephant> query = realm.where(Elephant.class);
query.contains(NAME, e.name, Case.INSENSITIVE);
if (e.chips1 != null) {
query.contains(CHIPS1, e.chips1, Case.INSENSITIVE);
}
if (!e.male) {
query.equalTo(MALE, false);
}
if (!e.female) {
query.equalTo(FEMALE, false);
}
return query.findAll();
}
示例2: transform
import io.realm.RealmQuery; //导入方法依赖的package包/类
@Override
public <T extends RealmModel> RealmQuery<T> transform(RealmQuery<T> realmQuery, Condition condition) {
// Checks.
if (!condition.isValid()) throw new IllegalArgumentException("Condition isn't valid.");
if (condition.getType() != Condition.Type.NORMAL)
throw new IllegalArgumentException("Condition type is not NORMAL.");
// Get data from Conditions.
String field = condition.getField();
FieldType fieldType = condition.getFieldType();
Object[] args = condition.getArgs();
// Use different methods based on field type.
if (FieldType.STRING == fieldType) return realmQuery.contains(field, (String) args[0]);
else
throw new IllegalArgumentException(String.format("Illegal argument type \"%s\".", fieldType.getTypeName()));
}
示例3: queryContains
import io.realm.RealmQuery; //导入方法依赖的package包/类
public static <E extends RealmObject> RealmResults<E> queryContains(final Realm realm, final Class<E> eClass, final String field, final String... filters) {
try {
final RealmQuery<E> realmQuery = realm.where(eClass);
int i = 0;
for (final String filter : filters) {
if (i != 0)
realmQuery.or();
realmQuery.contains(field, filter, false);
i++;
}
return getRealmResults(realmQuery);
} catch (Exception e) {
Log.d(TAG, "", e);
return null;
}
}
示例4: filterVehicle
import io.realm.RealmQuery; //导入方法依赖的package包/类
private static RealmQuery<Launch> filterVehicle(RealmQuery<Launch> query, ArrayList<String> vehicleFilter) {
boolean firstGroup = true;
for (String key : vehicleFilter) {
if (key.contains("SLV")) {
key = "SLV";
}
Timber.v("Vehicle key: %s", key);
if (!firstGroup) {
query.or();
} else {
firstGroup = false;
}
query.contains("rocket.name", key);
}
return query;
}
示例5: filterCountry
import io.realm.RealmQuery; //导入方法依赖的package包/类
private static RealmQuery<Launch> filterCountry(RealmQuery<Launch> query, ArrayList<String> countryFilter) {
boolean firstGroup = true;
for (String key : countryFilter) {
Timber.v("Country key: %s", key);
if (key.contains("China")) {
key = "CHN";
} else if (key.contains("Russia")) {
key = "RUS";
} else if (key.contains("India")) {
key = "IND";
} else if (key.contains("Multi")) {
key = ",";
}
if (!firstGroup) {
query.or();
} else {
firstGroup = false;
}
query.contains("location.pads.agencies.countryCode", key);
query.or();
query.contains("rocket.agencies.countryCode", key);
}
return query;
}
示例6: findNamedPlacesSortedAsync
import io.realm.RealmQuery; //导入方法依赖的package包/类
public static RealmResults<Place> findNamedPlacesSortedAsync(Realm realm, String name) {
RealmQuery<Place> query = realm.where(Place.class);
if (name != null && name.length() > 0) {
query.contains("name", name, Case.INSENSITIVE);
}
return query.findAllSortedAsync("name", Sort.ASCENDING);
}
示例7: findAllActiveOrRecentProjectsWithNameAsync
import io.realm.RealmQuery; //导入方法依赖的package包/类
public static RealmResults<Project> findAllActiveOrRecentProjectsWithNameAsync(Realm realm, long slack, String name) {
RealmQuery<Project> query = queryAllActiveOrRecentProjects(realm, slack);
if (name != null && name.length() > 0) {
query.contains("name", name, Case.INSENSITIVE);
}
return query.findAllAsync();
}
示例8: findNamedProjectsSortedAsync
import io.realm.RealmQuery; //导入方法依赖的package包/类
public static RealmResults<Project> findNamedProjectsSortedAsync(Realm realm, String name) {
RealmQuery<Project> query = realm.where(Project.class);
if (name != null && name.length() > 0) {
query.contains("name", name, Case.INSENSITIVE);
}
return query.findAllSortedAsync("name", Sort.ASCENDING);
}
示例9: generateResults
import io.realm.RealmQuery; //导入方法依赖的package包/类
@Override
public RealmResults<BookModel> generateResults(Realm realm) {
RealmQuery<BookModel> query = realm.where(BookModel.class);
query = query.equalTo("languageCode", language, Case.INSENSITIVE);
query = query.equalTo("versionCode", version, Case.INSENSITIVE);
query = query.contains("bookName", text, Case.INSENSITIVE);
return query.findAll().sort("bookNumber");
}