Class BooleanLiteral
- java.lang.Object
-
- org.datanucleus.store.rdbms.sql.expression.SQLExpression
-
- org.datanucleus.store.rdbms.sql.expression.BooleanExpression
-
- org.datanucleus.store.rdbms.sql.expression.BooleanLiteral
-
- All Implemented Interfaces:
SQLLiteral
public class BooleanLiteral extends BooleanExpression implements SQLLiteral
Representation of a Boolean literal in a Query.
-
-
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 BooleanLiteral(SQLStatement stmt, JavaTypeMapping mapping, Boolean value)
Creates a boolean literal with the specified value, using the provided mapping.BooleanLiteral(SQLStatement stmt, JavaTypeMapping mapping, Object value, String parameterName)
Creates a boolean literal with the specified value, using the provided mapping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanExpression
and(SQLExpression expr)
Conditional AND.BooleanExpression
eor(SQLExpression expr)
Exclusive ORBooleanExpression
eq(SQLExpression expr)
Equality operator (equals to)Object
getValue()
Accessor to the literal valueBooleanExpression
ior(SQLExpression expr)
Conditional OR.BooleanExpression
ne(SQLExpression expr)
Not equality operator (not equals to)BooleanExpression
not()
Logical complementvoid
setJavaTypeMapping(JavaTypeMapping mapping)
void
setNotParameter()
Method to set this literal as not being a parameter.protected void
setStatement()
-
Methods inherited from class org.datanucleus.store.rdbms.sql.expression.BooleanExpression
hasClosure, in, invoke, neg
-
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, sub, toSQLText, unDistinct
-
-
-
-
Constructor Detail
-
BooleanLiteral
public BooleanLiteral(SQLStatement stmt, JavaTypeMapping mapping, Object value, String parameterName)
Creates a boolean literal with the specified value, using the provided mapping. The boolean literal DOESN'T have closure using this constructor. This constructor will use the provided mapping in determining whether to put "TRUE"/"1=0", or "1"/"0" or "Y"/"N" in the SQL.- Parameters:
stmt
- The SQL statementmapping
- the mappingvalue
- the valueparameterName
- Parameter name (represented as JDBC "?")
-
BooleanLiteral
public BooleanLiteral(SQLStatement stmt, JavaTypeMapping mapping, Boolean value)
Creates a boolean literal with the specified value, using the provided mapping. The boolean expression has closure using this constructor. This constructor doesn't take into account the type of the mapping and how a boolean may be stored, just creating a literal (TRUE) and the SQL will simply be "TRUE"/"1=0".- Parameters:
stmt
- The SQL statementmapping
- the mappingvalue
- the boolean value
-
-
Method Detail
-
setJavaTypeMapping
public void setJavaTypeMapping(JavaTypeMapping mapping)
- Overrides:
setJavaTypeMapping
in classSQLExpression
-
getValue
public Object getValue()
Description copied from interface:SQLLiteral
Accessor to the literal value- Specified by:
getValue
in interfaceSQLLiteral
- Returns:
- the value of the literal
-
and
public BooleanExpression and(SQLExpression expr)
Description copied from class:SQLExpression
Conditional AND. Evaluates its right-hand operand only if the value of its left-hand operand is true.- Overrides:
and
in classBooleanExpression
- 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:SQLExpression
Exclusive OR- Overrides:
eor
in classBooleanExpression
- 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:SQLExpression
Conditional OR. Evaluates its right-hand operand only if the value of its left-hand operand is false.- Overrides:
ior
in classBooleanExpression
- 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:SQLExpression
Logical complement- Overrides:
not
in classBooleanExpression
- 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:SQLExpression
Equality operator (equals to)- Overrides:
eq
in classBooleanExpression
- 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:SQLExpression
Not equality operator (not equals to)- Overrides:
ne
in classBooleanExpression
- Parameters:
expr
- the right-hand operand- Returns:
- The type of an equality expression is a boolean
-
setNotParameter
public void setNotParameter()
Description copied from interface:SQLLiteral
Method to set this literal as not being a parameter. If the literal if not currently a parameter then does nothing. Updates any underlying SQL to have the value.- Specified by:
setNotParameter
in interfaceSQLLiteral
-
setStatement
protected void setStatement()
-
-