예제 #1
0
 private void visitRange(ConjunctionPredicate and) {
   if (and.getPredicates().size() != 2) {
     throw new IllegalArgumentException("no valid range");
   }
   GreaterThanOrEqualsPredicate lower = null;
   LessThanOrEqualsPredicate upper = null;
   for (Predicate p : and.getPredicates()) {
     if (p instanceof GreaterThanOrEqualsPredicate) {
       lower = (GreaterThanOrEqualsPredicate) p;
     } else if (p instanceof LessThanOrEqualsPredicate) {
       upper = (LessThanOrEqualsPredicate) p;
     }
   }
   if (lower == null || upper == null || lower.getKey() != upper.getKey()) {
     throw new IllegalArgumentException("no valid range");
   }
   addParamValue(lower.getKey(), "", lower.getValue() + "-" + upper.getValue());
 }
예제 #2
0
 private void visit(LessThanOrEqualsPredicate predicate) {
   addParamValue(predicate.getKey(), LESS_THAN_EQUALS_OPERATOR, predicate.getValue());
 }