#605 - Add and() and or() ... as synonyms for conjunction() and disjunction() ... to the "Query Criteria API"

This commit is contained in:
Robin Bygrave
2016-03-18 13:06:10 +13:00
parent 5d889790c2
commit 3ddd7099b5
5 changed files with 70 additions and 9 deletions
@@ -888,6 +888,18 @@ public interface ExpressionList<T> {
*/
ExpressionList<T> not(Expression exp);
/**
* Return a list of expressions that will be joined by AND's.
* This is exactly the same as conjunction();
*/
Junction<T> and();
/**
* Return a list of expressions that will be joined by OR's.
* This is exactly the same as disjunction();
*/
Junction<T> or();
/**
* Return a list of expressions that will be joined by AND's.
*/
@@ -652,6 +652,16 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
return junction;
}
@Override
public Junction<T> and() {
return conjunction();
}
@Override
public Junction<T> or() {
return disjunction();
}
@Override
public Junction<T> conjunction() {
Junction<T> conjunction = expr.conjunction(query, this);
@@ -320,6 +320,16 @@ abstract class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, E
return exprList.betweenProperties(lowProperty, highProperty, value);
}
@Override
public Junction<T> and() {
return conjunction();
}
@Override
public Junction<T> or() {
return disjunction();
}
@Override
public Junction<T> conjunction() {
return exprList.conjunction();