mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
#2768 - ENH: Add eqIfPresent() - a helper expression for fluid style when some EQ are optional
This commit is contained in:
1 parent
f930471beb
commit
7474430a63
6 files changed
+116
-3
No files matched your search
@@ -798,6 +798,11 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return add(expr.eq(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> eqIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : add(expr.eq(propertyName, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> eqOrNull(String propertyName, Object value) {
|
||||
return add(expr.eqOrNull(propertyName, value));
|
||||
|
||||
@@ -309,6 +309,11 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
|
||||
return exprList.eq(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> eqIfPresent(String propertyName, @Nullable Object value) {
|
||||
return value == null ? this : exprList.eq(propertyName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> eqOrNull(String propertyName, Object value) {
|
||||
return exprList.eqOrNull(propertyName, value);
|
||||
|
||||
Reference in new issue
Block a user