private static boolean listContainsLessThanOrEqual(List list, Object whereValue) { for (Object value : list) { if (compareObjects(value, whereValue) <= 0) { return true; } } return false; }
private boolean isNull(WhereOperator whereOperator, Object actualValue) { return whereOperator.equals(WhereOperator.EQUAL) && actualValue == null; }
@Override public BaseCondition not() { return new SimpleCondition(field, whereOperator.reverse(), whereValue); }
@Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<>(); map.put("field", field); map.put("whereOperator", whereOperator.toString()); map.put("whereValue", whereValue); return map; }
public static BaseCondition c(String field, String operator, Object comparison) { return c(field, WhereOperator.toOperator(operator), comparison); }
@Override public boolean evaluate(Object object) { try { Object objectValue = new ConditionReference(field, clazz, object).getValue(); return whereOperator.evaluate(objectValue, whereValue); } catch (ConditionForChildException e) { return true; } }
private String whereSingleValue(String fieldName, String actualFieldName, WhereOperator whereOperator, Object actualValue) { if (isNull(whereOperator, actualValue)) { return whereSingleValueIsNull(actualFieldName); } String placeHolder = bindValue(actualValue); if (isList(fieldName)) { return String.format(":%s %s ANY(ARRAY(select * from json_array_elements_text(to_json(%s))))", placeHolder, filterOperatorAsText(whereOperator.reverse()), propertyLink(fieldName, actualFieldName, false)); } return String.format("%s %s :%s", propertyLink(fieldName, actualFieldName), filterOperatorAsText(whereOperator), placeHolder); }
private static boolean listContainsGreaterThan(List list, Object whereValue) { for (Object value : list) { if (compareObjects(value, whereValue) > 0) { return true; } } return false; }
private static boolean listContainsLessThan(List list, Object whereValue) { for (Object value : list) { if (compareObjects(value, whereValue) < 0) { return true; } } return false; }
private static boolean listContainsGreaterThanOrEqual(List list, Object whereValue) { for (Object value : list) { if (compareObjects(value, whereValue) >= 0) { return true; } } return false; }