mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#607 - bool conversion for and(), or() and not()
This commit is contained in:
@@ -18,9 +18,9 @@ import java.util.Map;
|
||||
public interface DocQueryContext {
|
||||
|
||||
/**
|
||||
* Start a conjunction or disjunction.
|
||||
* Start a junction.
|
||||
*/
|
||||
void startBool(boolean conjunction) throws IOException;
|
||||
void startBool(Junction.Type type) throws IOException;
|
||||
|
||||
/**
|
||||
* Start a conjunction.
|
||||
|
||||
@@ -63,7 +63,7 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
|
||||
@Override
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
context.startBool(type == Type.AND);
|
||||
context.startBool(type);
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).writeDocQuery(context);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.avaje.ebeaninternal.server.expression;
|
||||
|
||||
import com.avaje.ebean.Expression;
|
||||
import com.avaje.ebean.Junction;
|
||||
import com.avaje.ebean.event.BeanQueryRequest;
|
||||
import com.avaje.ebeaninternal.api.HashQueryPlanBuilder;
|
||||
import com.avaje.ebeaninternal.api.ManyWhereJoins;
|
||||
@@ -60,7 +61,7 @@ abstract class LogicExpression implements SpiExpression {
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
|
||||
boolean conjunction = joinType.equals(AND);
|
||||
context.startBool(conjunction);
|
||||
context.startBool(conjunction ? Junction.Type.AND : Junction.Type.OR);
|
||||
expOne.writeDocQuery(context);
|
||||
expTwo.writeDocQuery(context);
|
||||
context.endBool();
|
||||
|
||||
Reference in New Issue
Block a user