org.datanucleus.store.rdbms.sql.expression
Class EnumExpression

java.lang.Object
  extended by org.datanucleus.store.rdbms.sql.expression.SQLExpression
      extended by org.datanucleus.store.rdbms.sql.expression.EnumExpression
Direct Known Subclasses:
EnumLiteral

public class EnumExpression
extends SQLExpression

Expression representing an enum field/property. An enum can be represented as a String or as a numeric hence requires its own expression. Implemented as an internal delegate of the correct root expression type.


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
isParameter, LOCALISER, lowestOperator, mapping, st, stmt, subExprs, table
 
Constructor Summary
EnumExpression(SQLStatement stmt, SQLTable table, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
          Constructor for an expression for an enum field/property.
 
Method Summary
 SQLExpression add(SQLExpression expr)
          Additive Operator.
 SQLExpression div(SQLExpression expr)
          Division Operator.
 BooleanExpression eq(SQLExpression expr)
          Equality operator (equals to)
 BooleanExpression ge(SQLExpression expr)
          Relational operator (greater than or equals)
 SQLExpression getDelegate()
          Accessor for the delegate that represents this enum.
 BooleanExpression gt(SQLExpression expr)
          Relational operator (greater than)
 SQLExpression invoke(java.lang.String methodName, java.util.List args)
          Invocation of a method on this expression.
 BooleanExpression le(SQLExpression expr)
          Relational operator (lower than or equals)
 BooleanExpression lt(SQLExpression expr)
          Relational operator (lower than)
 SQLExpression mod(SQLExpression expr)
          Remainder Operator.
 SQLExpression mul(SQLExpression expr)
          Multiplication Operator
 BooleanExpression ne(SQLExpression expr)
          Not equality operator (not equals to)
 SQLExpression sub(SQLExpression expr)
          Additive Operator.
 SQLText toSQLText()
          Method to return the SQL form of this expression.
 
Methods inherited from class org.datanucleus.store.rdbms.sql.expression.SQLExpression
and, cast, checkForAndCorrectParameterComparison, com, encloseInParentheses, eor, getJavaTypeMapping, getNumberOfSubExpressions, getSQLStatement, getSQLTable, in, ior, is, isParameter, neg, not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumExpression

public EnumExpression(SQLStatement stmt,
                      SQLTable table,
                      org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
Constructor for an expression for an enum field/property.

Parameters:
stmt - The SQL statement
table - Table containing the enum
mapping - Mapping for the enum
Method Detail

eq

public BooleanExpression eq(SQLExpression expr)
Description copied from class: SQLExpression
Equality operator (equals to)

Overrides:
eq in class SQLExpression
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 class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
The type of an equality expression is a boolean

add

public SQLExpression add(SQLExpression expr)
Description copied from class: SQLExpression
Additive Operator. The binary + operator performs addition when applied to two operands of numeric type, producing the sum of the operands. If the type of either operand of a + operator is String, then the operation is string concatenation.

Overrides:
add in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
If one of the operands is String, the returned value is the string concatenation; The sum of two operands of numeric type. The left-hand operand is the minuend and the right-hand operand is the subtrahend;

div

public SQLExpression div(SQLExpression expr)
Description copied from class: SQLExpression
Division Operator. The left-hand operand is the dividend and the right-hand operand is the divisor.

Overrides:
div in class SQLExpression
Parameters:
expr - the right-hand operator
Returns:
The binary / operator performs division, producing the quotient of its operands

ge

public BooleanExpression ge(SQLExpression expr)
Description copied from class: SQLExpression
Relational operator (greater than or equals)

Overrides:
ge in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
true if the value of the left-hand operand is greater than or equal the value of the right-hand operand, and otherwise is false.

gt

public BooleanExpression gt(SQLExpression expr)
Description copied from class: SQLExpression
Relational operator (greater than)

Overrides:
gt in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
true if the value of the left-hand operand is greater than the value of the right-hand operand, and otherwise is false.

le

public BooleanExpression le(SQLExpression expr)
Description copied from class: SQLExpression
Relational operator (lower than or equals)

Overrides:
le in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
true if the value of the left-hand operand is less than or equal to the value of the right-hand operand, and otherwise is false.

lt

public BooleanExpression lt(SQLExpression expr)
Description copied from class: SQLExpression
Relational operator (lower than)

Overrides:
lt in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
true if the value of the left-hand operand is less than the value of the right-hand operand, and otherwise is false.

mod

public SQLExpression mod(SQLExpression expr)
Description copied from class: SQLExpression
Remainder Operator. The left-hand operand is the dividend and the right-hand operand is the divisor.

Overrides:
mod in class SQLExpression
Parameters:
expr - the right-hand operator
Returns:
The binary % operator is said to yield the remainder of its operands from an implied division

mul

public SQLExpression mul(SQLExpression expr)
Description copied from class: SQLExpression
Multiplication Operator

Overrides:
mul in class SQLExpression
Parameters:
expr - the right-hand operator
Returns:
The binary * operator performs multiplication, producing the product of its operands.

sub

public SQLExpression sub(SQLExpression expr)
Description copied from class: SQLExpression
Additive Operator. The binary - operator subtracts right-hand operand from left-hand operand.

Overrides:
sub in class SQLExpression
Parameters:
expr - the right-hand operand
Returns:
The binary - operator performs subtraction when applied to two operands of numeric type producing the difference of its operands; the left-hand operand is the minuend and the right-hand operand is the subtrahend.

invoke

public SQLExpression invoke(java.lang.String methodName,
                            java.util.List args)
Description copied from class: SQLExpression
Invocation of a method on this expression.

Overrides:
invoke in class SQLExpression
Parameters:
methodName - name of the method to invoke
args - Args to this method (if any)
Returns:
the converted value

toSQLText

public SQLText toSQLText()
Description copied from class: SQLExpression
Method to return the SQL form of this expression.

Overrides:
toSQLText in class SQLExpression
Returns:
The SQL

getDelegate

public SQLExpression getDelegate()
Accessor for the delegate that represents this enum. Will be either a StringExpression or a NumericExpression depending whether the enum is stored as a string or as a numeric.

Returns:
The delegate


Copyright © 2009. All Rights Reserved.