#1643 - ENH: Add expression inOrEmpty() ... as a convenience for conditionally added a IN expression

This commit is contained in:
rob bygrave
2019-03-01 18:24:00 +13:00
parent 888384f7db
commit a4698ea1b6
9 changed files with 301 additions and 21 deletions
@@ -455,6 +455,16 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
return new InExpression(propertyName, values, false);
}
/**
* In where null or empty values means that no predicate is added to the query.
* <p>
* That is, only add the IN predicate if the values are not null or empty.
*/
@Override
public Expression inOrEmpty(String propertyName, Collection<?> values) {
return new InExpression(propertyName, values, false, true);
}
/**
* In - property has a value in the array of values.
*/