本文整理了Java中com.psddev.dari.db.Query.setPredicate
方法的一些代码示例,展示了Query.setPredicate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setPredicate
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:setPredicate
[英]Sets the predicate for filtering the result.
[中]设置筛选结果的谓词。
代码示例来源:origin: perfectsense/dari
/**
* Combines the given {@code predicate} with the current one using
* {@code OR} logic. If the current predicate is {@code null},
* the given {@code predicate} replaces it.
*/
public Query<E> or(Predicate predicate) {
if (predicate != null) {
Predicate lastPredicate = getPredicate();
setPredicate(lastPredicate != null
? CompoundPredicate.combine(PredicateParser.OR_OPERATOR, lastPredicate, predicate)
: predicate);
}
return this;
}
代码示例来源:origin: perfectsense/dari
/**
* Combines the given {@code predicate} with the current one using
* {@code NOT} logic. If the current predicate is {@code null},
* the given {@code predicate} replaces it.
*/
public Query<E> not(Predicate predicate) {
if (predicate != null) {
predicate = new CompoundPredicate(PredicateParser.NOT_OPERATOR, Arrays.asList(predicate));
Predicate lastPredicate = getPredicate();
setPredicate(lastPredicate != null
? CompoundPredicate.combine(PredicateParser.AND_OPERATOR, lastPredicate, predicate)
: predicate);
}
return this;
}
代码示例来源:origin: perfectsense/dari
if (predicate != null) {
Predicate lastPredicate = getPredicate();
setPredicate(lastPredicate != null
? CompoundPredicate.combine(PredicateParser.AND_OPERATOR, lastPredicate, predicate)
: predicate);
代码示例来源:origin: perfectsense/dari
query.setPredicate(PredicateParser.Static.parse("_id = ?", newValues));
代码示例来源:origin: perfectsense/dari
@Override
public Query<E> clone() {
Query<E> clone = new Query<E>(group, objectClass);
clone.setPredicate(predicate);
clone.setSorters(sorters != null ? new ArrayList<Sorter>(sorters) : null);
clone.setFields(fields != null ? new ArrayList<String>(fields) : null);
clone.setDatabase(database);
clone.setResolveToReferenceOnly(isResolveToReferenceOnly);
clone.setCache(!noCache);
clone.setMaster(master);
clone.setResolveInvisible(resolveInvisible);
clone.setTimeout(timeout);
clone.setOptions(options != null ? new HashMap<String, Object>(options) : null);
return clone;
}
代码示例来源:origin: perfectsense/dari
childQuery.setPredicate(child);
代码示例来源:origin: perfectsense/dari
childQuery.setPredicate(child);
代码示例来源:origin: perfectsense/brightspot-cms
public Query<?> toQuery() {
State state = getState();
Query<?> query = Query.fromType(getQueryType());
Predicate predicate = query.getPredicate();
for (ObjectField field : getIndexedFields()) {
String name = field.getInternalName();
Object value = state.get(FIELD_PREFIX + name);
if (!ObjectUtils.isBlank(value)) {
String type = field.getInternalItemType();
String operator = (String) state.get(OPERATOR_PREFIX + name);
if (operator == null) {
operator = ObjectField.REFERENTIAL_TEXT_TYPE.equals(type) || ObjectField.TEXT_TYPE.equals(type) ? "matchesAll" : "equalsAny";
}
predicate = CompoundPredicate.combine(
PredicateParser.AND_OPERATOR,
predicate,
PredicateParser.Static.parse(name + " " + operator + " ?", value));
}
}
query.setPredicate(predicate);
ObjectField sortField = getSortField();
if (ObjectField.DATE_TYPE.equals(sortField.getInternalItemType())) {
query.sortDescending(sortField.getInternalName());
} else {
query.sortAscending(sortField.getInternalName());
}
return query;
}
内容来源于网络,如有侵权,请联系作者删除!