本文整理汇总了Java中org.kuali.rice.core.api.criteria.InPredicate类的典型用法代码示例。如果您正苦于以下问题:Java InPredicate类的具体用法?Java InPredicate怎么用?Java InPredicate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InPredicate类属于org.kuali.rice.core.api.criteria包,在下文中一共展示了InPredicate类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: splitMultiValuePredicate
import org.kuali.rice.core.api.criteria.InPredicate; //导入依赖的package包/类
/**
* This method takes in a multi-value predicate which has more values than
* can fit into a single SQL clause and splits them up into multiple
* clauses which are concatenated by an OR statement.
* @param p The predicate which needs to be split into smaller predicates
* @param parent The criteria to add the predicate to
*/
private void splitMultiValuePredicate(MultiValuedPredicate p, C parent) {
final String pp = p.getPropertyPath();
int chunkCount = (int)Math.ceil(p.getValues().size() / (double)MULTI_VALUE_CHUNK_SIZE);
Predicate[] multiValuePredicateChunks = new Predicate[chunkCount];
Object[] values = p.getValues().toArray();
int start = 0;
for(int i = 0; i < chunkCount; i++) {
Object[] valueChunk = Arrays.copyOfRange(values, start, start + MULTI_VALUE_CHUNK_SIZE);
if (p instanceof InPredicate) {
multiValuePredicateChunks[i] = PredicateFactory.in(pp, valueChunk);
} else if (p instanceof InIgnoreCasePredicate) {
multiValuePredicateChunks[i] = PredicateFactory.inIgnoreCase(pp, (CharSequence[])valueChunk);
} else if (p instanceof NotInPredicate) {
multiValuePredicateChunks[i] = PredicateFactory.notIn(pp, valueChunk);
} else if (p instanceof NotInIgnoreCasePredicate) {
multiValuePredicateChunks[i] = PredicateFactory.notInIgnoreCase(pp, (CharSequence[])valueChunk);
} else {
throw new UnsupportedPredicateException(p);
}
start += MULTI_VALUE_CHUNK_SIZE;
}
addPredicate(PredicateFactory.or(multiValuePredicateChunks), parent);
}