當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。