当前位置: 首页>>代码示例>>Java>>正文


Java RealmQuery.contains方法代码示例

本文整理汇总了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();
}
 
开发者ID:goutfeb,项目名称:ElephantAsia,代码行数:20,代码来源:SearchElephantResultActivity.java

示例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()));
}
 
开发者ID:bkromhout,项目名称:Ruqus,代码行数:18,代码来源:StringContains.java

示例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;
        }

    }
 
开发者ID:murielK,项目名称:AndroidWPTemplate,代码行数:19,代码来源:RealmHelper.java

示例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;
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:17,代码来源:QueryBuilder.java

示例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;
}
 
开发者ID:ItsCalebJones,项目名称:SpaceLaunchNow-Android,代码行数:25,代码来源:QueryBuilder.java

示例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);
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:8,代码来源:Place.java

示例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();
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:8,代码来源:Project.java

示例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);
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:8,代码来源:Project.java

示例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");
}
 
开发者ID:friendsofagape,项目名称:Autographa-Go,代码行数:9,代码来源:AllSpecifications.java


注:本文中的io.realm.RealmQuery.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。