mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-23 23:13:55 +00:00
Add _ifPresent() expressions for GT, GE, LT, LE (follow up from #2768)
This commit is contained in:
1 parent
6e98486a03
commit
0b615a79cc
6 files changed
+208
-6
No files matched your search
+20
@@ -903,6 +903,16 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return add(expr.geOrNull(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> gtIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : add(expr.gt(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> geIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : add(expr.ge(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> icontains(String propertyName, String value) {
|
||||
return add(expr.icontains(propertyName, value));
|
||||
@@ -1061,6 +1071,16 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return add(expr.leOrNull(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> ltIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : add(expr.lt(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> leIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : add(expr.le(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> not(Expression exp) {
|
||||
return add(expr.not(exp));
|
||||
|
||||
@@ -677,6 +677,16 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
|
||||
return exprList.geOrNull(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> gtIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : exprList.gt(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> geIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : exprList.ge(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> having() {
|
||||
throw new IllegalStateException("having() not allowed on Junction expression list");
|
||||
@@ -837,6 +847,16 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
|
||||
return exprList.leOrNull(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> ltIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : exprList.lt(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> leIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : exprList.le(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> ne(String propertyName, Query<?> subQuery) {
|
||||
return exprList.ne(propertyName, subQuery);
|
||||
|
||||
Reference in new issue
Block a user