mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#727 - ENH: Add endOr(), endAnd(), endNot() ... to ExpressionList as synonym for endJunction()
This commit is contained in:
@@ -925,7 +925,7 @@ public interface ExpressionList<T> {
|
||||
* This is exactly the same as conjunction();
|
||||
* </p>
|
||||
* <p>
|
||||
* Use endJunction() to end the AND junction.
|
||||
* Use endAnd() or endJunction() to end the AND junction.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that a where() clause defaults to an AND junction so
|
||||
@@ -943,11 +943,11 @@ public interface ExpressionList<T> {
|
||||
* .and() // nested and
|
||||
* .startsWith("name", "r")
|
||||
* .eq("anniversary", onAfter)
|
||||
* .endJunction() // end AND junction
|
||||
* .endAnd()
|
||||
* .and()
|
||||
* .eq("status", Customer.Status.ACTIVE)
|
||||
* .gt("id", 0)
|
||||
* .endJunction() // end AND junction
|
||||
* .endAnd()
|
||||
* .orderBy().asc("name")
|
||||
* .findList();
|
||||
* }</pre>
|
||||
@@ -959,7 +959,7 @@ public interface ExpressionList<T> {
|
||||
* This is exactly the same as disjunction();
|
||||
*
|
||||
* <p>
|
||||
* Use endJunction() to end the OR junction.
|
||||
* Use endOr() or endJunction() to end the OR junction.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
@@ -973,11 +973,11 @@ public interface ExpressionList<T> {
|
||||
* .and()
|
||||
* .startsWith("name", "r")
|
||||
* .eq("anniversary", onAfter)
|
||||
* .endJunction() // end AND junction
|
||||
* .endAnd()
|
||||
* .and()
|
||||
* .eq("status", Customer.Status.ACTIVE)
|
||||
* .gt("id", 0)
|
||||
* .endJunction() // end AND junction
|
||||
* .endAnd()
|
||||
* .orderBy().asc("name")
|
||||
* .findList();
|
||||
*
|
||||
@@ -988,7 +988,7 @@ public interface ExpressionList<T> {
|
||||
/**
|
||||
* Return a list of expressions that will be wrapped by NOT.
|
||||
* <p>
|
||||
* Use endJunction() to end expressions being added to the
|
||||
* Use endNot() or endJunction() to end expressions being added to the
|
||||
* NOT expression list.
|
||||
* </p>
|
||||
*
|
||||
@@ -998,7 +998,7 @@ public interface ExpressionList<T> {
|
||||
* .not()
|
||||
* .gt("id", 1)
|
||||
* .eq("anniversary", onAfter)
|
||||
* .endJunction() // end the not expressions
|
||||
* .endNot()
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
@@ -1012,7 +1012,7 @@ public interface ExpressionList<T> {
|
||||
* .not()
|
||||
* .gt("id", 1)
|
||||
* .eq("anniversary", onAfter)
|
||||
* .endJunction() // end the not expressions
|
||||
* .endNot()
|
||||
* .orderBy()
|
||||
* .asc("name")
|
||||
* .findList();
|
||||
@@ -1085,4 +1085,19 @@ public interface ExpressionList<T> {
|
||||
*/
|
||||
ExpressionList<T> endJunction();
|
||||
|
||||
/**
|
||||
* End a AND junction - synonym for endJunction().
|
||||
*/
|
||||
ExpressionList<T> endAnd();
|
||||
|
||||
/**
|
||||
* End a AND junction - synonym for endJunction().
|
||||
*/
|
||||
ExpressionList<T> endOr();
|
||||
|
||||
/**
|
||||
* End a NOT junction - synonym for endJunction().
|
||||
*/
|
||||
ExpressionList<T> endNot();
|
||||
|
||||
}
|
||||
|
||||
@@ -925,6 +925,21 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return parentExprList == null ? this : parentExprList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endAnd() {
|
||||
return endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endOr() {
|
||||
return endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endNot() {
|
||||
return endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Junction<T> and() {
|
||||
return conjunction();
|
||||
|
||||
@@ -776,4 +776,18 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
return exprList.endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endAnd() {
|
||||
return endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endOr() {
|
||||
return endJunction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> endNot() {
|
||||
return endJunction();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user