本文整理匯總了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);
}