本文整理汇总了Java中javax.persistence.criteria.CriteriaBuilder.conjunction方法的典型用法代码示例。如果您正苦于以下问题:Java CriteriaBuilder.conjunction方法的具体用法?Java CriteriaBuilder.conjunction怎么用?Java CriteriaBuilder.conjunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.criteria.CriteriaBuilder
的用法示例。
在下文中一共展示了CriteriaBuilder.conjunction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
@Override
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
List<Predicate> predicates = newArrayList();
for (Range<T> range : ranges) {
if (range.isSet()) {
Predicate rangePredicate = buildRangePredicate(range, root, builder);
if (rangePredicate != null) {
if (!range.isIncludeNullSet() || range.getIncludeNull() == FALSE) {
predicates.add(rangePredicate);
} else {
predicates.add(builder.or(rangePredicate, builder.isNull(root.get(range.getField()))));
}
}
if (TRUE == range.getIncludeNull()) {
predicates.add(builder.isNull(root.get(range.getField())));
} else if (FALSE == range.getIncludeNull()) {
predicates.add(builder.isNotNull(root.get(range.getField())));
}
}
}
return predicates.isEmpty() ? builder.conjunction() : builder.and(toArray(predicates, Predicate.class));
}
示例2: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Predicate toPredicate(final Root<T> root, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
Predicate predicate = cb.conjunction();
predicate = getPredicateColonnes(root, query, cb, predicate);
predicate = getPredicateGlobalSearch(root, query, cb, predicate);
return predicate;
}
示例3: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query,
CriteriaBuilder builder) {
if (!criterions.isEmpty()) {
List<Predicate> predicates = new ArrayList<Predicate>();
for(Criterion c : criterions){
predicates.add(c.toPredicate(root, query,builder));
}
// 将所有条件用 and 联合起来
if (predicates.size() > 0) {
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
}
}
return builder.conjunction();
}
示例4: getGroupPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
/**
* Create a predicate group.
*/
private Predicate getGroupPredicate(final UiFilter group, final Root<U> root, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
// Build the predicates
final java.util.List<Predicate> predicates = getPredicates(group, root, query, cb);
// Build the specification
if (predicates.isEmpty()) {
return cb.conjunction();
}
final Predicate[] filteredPredicates = predicates.toArray(new Predicate[predicates.size()]);
if (group.getGroupOp() == FilterOperator.AND) {
return cb.and(filteredPredicates);
}
return cb.or(filteredPredicates);
}
示例5: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
@Override
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
if (!criterions.isEmpty()) {
List<Predicate> predicates = new ArrayList<Predicate>();
for (Criterion c : criterions) {
predicates.add(c.toPredicate(root, query, builder));
}
// 将所有条件用 and 联合起来
if (predicates.size() > 0) {
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
}
}
return builder.conjunction();
}