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
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 SQLExpression
SQLExpression.ColumnExpressionList -
Field Summary
FieldsFields inherited from class SQLExpression
lowestOperator, mapping, parameterName, st, stmt, subExprs, table -
Constructor Summary
ConstructorsConstructorDescriptionBooleanExpression(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
Modifier and TypeMethodDescriptionand(SQLExpression expr) Conditional AND.eor(SQLExpression expr) Exclusive OReq(SQLExpression expr) Equality operator (equals to)booleanin(SQLExpression expr, boolean not) In expression.invoke(String methodName, List<SQLExpression> args) Invocation of a method on this expression.ior(SQLExpression expr) Conditional OR.ne(SQLExpression expr) Not equality operator (not equals to)neg()Unary Minus Operatornot()Logical complementMethods inherited from class 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
-
Field Details
-
hasClosure
boolean hasClosure
-
-
Constructor Details
-
BooleanExpression
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
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
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 Details
-
hasClosure
public boolean hasClosure() -
and
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
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
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
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
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
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
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
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
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.
-