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


Java CriteriaBuilder.conjunction方法代码示例

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

示例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;
}
 
开发者ID:andresoviedo,项目名称:datatable-java,代码行数:11,代码来源:DatatableSpecification.java

示例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();  
}
 
开发者ID:wengwh,项目名称:plumdo-stock,代码行数:15,代码来源:Criteria.java

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

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


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