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()); }
private void visit(GreaterThanOrEqualsPredicate predicate) { addParamValue(predicate.getKey(), GREATER_THAN_EQUALS_OPERATOR, predicate.getValue()); }