Class BooleanExpression
- java.lang.Object
-
- org.datanucleus.store.rdbms.sql.expression.SQLExpression
-
- org.datanucleus.store.rdbms.sql.expression.BooleanExpression
-
- Direct Known Subclasses:
BooleanLiteral,BooleanSubqueryExpression,CaseBooleanExpression,InExpression
public class BooleanExpression extends SQLExpression
Representation of a Boolean expression in a Query. Can be represented in one of the following ways in the datastore- As String-based, so stored as "Y", "N"
- As numeric-based, so stored as 1, 0
- As boolean-based, so stored as true, false
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.sql.expression.SQLExpression
SQLExpression.ColumnExpressionList
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.sql.expression.SQLExpression
lowestOperator, mapping, parameterName, st, stmt, subExprs, table
-
-
Constructor Summary
Constructors Constructor Description BooleanExpression(org.datanucleus.store.query.expression.Expression.MonadicOperator op, SQLExpression expr1)Perform an operationBooleanExpression(SQLExpression expr1, org.datanucleus.store.query.expression.Expression.DyadicOperator op, SQLExpression expr2)Perform an operationBooleanExpression(SQLStatement stmt, JavaTypeMapping mapping)Constructor for a boolean expression for the specified mapping of the table.BooleanExpression(SQLStatement stmt, JavaTypeMapping mapping, String sql)Constructor for a boolean expression for the specified mapping using the specified SQL text.BooleanExpression(SQLStatement stmt, JavaTypeMapping mapping, String functionName, List<SQLExpression> args)Generates statement as "FUNCTION_NAME(arg [,argN])" such as STARTS_WITH(arg1, arg2).BooleanExpression(SQLStatement stmt, SQLTable table, JavaTypeMapping mapping)Constructor for a boolean expression for the specified mapping of the table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanExpressionand(SQLExpression expr)Conditional AND.BooleanExpressioneor(SQLExpression expr)Exclusive ORBooleanExpressioneq(SQLExpression expr)Equality operator (equals to)booleanhasClosure()BooleanExpressionin(SQLExpression expr, boolean not)In expression.SQLExpressioninvoke(String methodName, List args)Invocation of a method on this expression.BooleanExpressionior(SQLExpression expr)Conditional OR.BooleanExpressionne(SQLExpression expr)Not equality operator (not equals to)BooleanExpressionneg()Unary Minus OperatorBooleanExpressionnot()Logical complement-
Methods inherited from class org.datanucleus.store.rdbms.sql.expression.SQLExpression
add, bitAnd, bitOr, cast, com, distinct, div, encloseInParentheses, ge, getJavaTypeMapping, getLowestOperator, getNumberOfSubExpressions, getParameterName, getSQLStatement, getSQLTable, getSubExpression, gt, is, isParameter, le, lt, mod, mul, setJavaTypeMapping, sub, toSQLText, unDistinct
-
-
-
-
Constructor Detail
-
BooleanExpression
public BooleanExpression(SQLStatement stmt, JavaTypeMapping mapping, String sql)
Constructor for a boolean expression for the specified mapping using the specified SQL text.- Parameters:
stmt- The statementmapping- the mapping associated to this expressionsql- The SQL text that will return a boolean
-
BooleanExpression
public BooleanExpression(SQLStatement stmt, JavaTypeMapping mapping, String functionName, List<SQLExpression> args)
Generates statement as "FUNCTION_NAME(arg [,argN])" such as STARTS_WITH(arg1, arg2).- Parameters:
stmt- The statementmapping- Mapping to usefunctionName- Name of functionargs- SQLExpression list
-
BooleanExpression
public BooleanExpression(SQLStatement stmt, SQLTable table, JavaTypeMapping mapping)
Constructor for a boolean expression for the specified mapping of the table. The boolean expression DOESN'T have closure using this constructor.- Parameters:
stmt- The statementtable- The table this mapping belongs tomapping- the mapping associated to this expression
-
BooleanExpression
public BooleanExpression(SQLStatement stmt, JavaTypeMapping mapping)
Constructor for a boolean expression for the specified mapping of the table. The boolean expression has closure using this constructor.- Parameters:
stmt- The statementmapping- the mapping associated to this expression
-
BooleanExpression
public BooleanExpression(org.datanucleus.store.query.expression.Expression.MonadicOperator op, SQLExpression expr1)Perform an operationop
on expressionexpr1
. The boolean expression has closure using this constructor.- Parameters:
op- operatorexpr1- operand
-
BooleanExpression
public BooleanExpression(SQLExpression expr1, org.datanucleus.store.query.expression.Expression.DyadicOperator op, SQLExpression expr2)
Perform an operationop
betweenexpr1
andexpr2
. The boolean expression has closure using this constructor.- Parameters:
expr1- the first expressionop- the operator between operandsexpr2- the second expression
-
-
Method Detail
-
hasClosure
public boolean hasClosure()
-
and
public BooleanExpression and(SQLExpression expr)
Description copied from class:SQLExpressionConditional AND. Evaluates its right-hand operand only if the value of its left-hand operand is true.- Overrides:
andin classSQLExpression- Parameters:
expr- the right-hand operand- Returns:
- the result value is true if both operand values are true; otherwise, the result is false.
-
eor
public BooleanExpression eor(SQLExpression expr)
Description copied from class:SQLExpressionExclusive OR- Overrides:
eorin classSQLExpression- Parameters:
expr- the right-hand operand- Returns:
- the result value is the bitwise exclusive OR of the operand values.
-
ior
public BooleanExpression ior(SQLExpression expr)
Description copied from class:SQLExpressionConditional OR. Evaluates its right-hand operand only if the value of its left-hand operand is false.- Overrides:
iorin classSQLExpression- Parameters:
expr- the right-hand operand- Returns:
- the result value is false if both operand values are false; otherwise, the result is true.
-
not
public BooleanExpression not()
Description copied from class:SQLExpressionLogical complement- Overrides:
notin classSQLExpression- Returns:
- the result value is false if operand is true; otherwise, the result is true.
-
eq
public BooleanExpression eq(SQLExpression expr)
Description copied from class:SQLExpressionEquality operator (equals to)- Overrides:
eqin classSQLExpression- Parameters:
expr- the right-hand operand- Returns:
- The type of an equality expression is a boolean
-
ne
public BooleanExpression ne(SQLExpression expr)
Description copied from class:SQLExpressionNot equality operator (not equals to)- Overrides:
nein classSQLExpression- Parameters:
expr- the right-hand operand- Returns:
- The type of an equality expression is a boolean
-
in
public BooleanExpression in(SQLExpression expr, boolean not)
Description copied from class:SQLExpressionIn expression. Return true if this is contained byexpr- Overrides:
inin classSQLExpression- Parameters:
expr- the right-hand expressionnot- Whether we really want "not in"- Returns:
- true if the left-hand expression is contained by the right-hand expression. Otherwise the result is false.
-
invoke
public SQLExpression invoke(String methodName, List args)
Description copied from class:SQLExpressionInvocation of a method on this expression.- Overrides:
invokein classSQLExpression- Parameters:
methodName- name of the method to invokeargs- Args to this method (if any)- Returns:
- the converted value
-
neg
public BooleanExpression neg()
Description copied from class:SQLExpressionUnary Minus Operator- Overrides:
negin classSQLExpression- Returns:
- the type of the unary minus expression is the promoted type of the operand.
-
-