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

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

public class ObjectExpression
extends SQLExpression

Representation of an Object expression in a Query. Typically represents a persistable object, and so its identity, though could be used to represent any Object.

Let's take an example. We have classes A and B, and A contains a reference to B "b". If we do a JDOQL query for class A of "b == value" then "b" is interpreted first and an ObjectExpression is created to represent that object (of type B).


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
ObjectExpression(SQLStatement stmt, SQLTable table, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
          Constructor for an SQL expression for a (field) mapping in a specified table.
 
Method Summary
 SQLExpression cast(SQLExpression expr)
          Cast operator.
 BooleanExpression eq(SQLExpression expr)
          Equals operator.
 BooleanExpression in(SQLExpression expr)
          In expression.
 BooleanExpression is(SQLExpression expr)
          An "is" (instanceOf) expression, providing a BooleanExpression whether this expression is an instanceof the provided type.
 BooleanExpression ne(SQLExpression expr)
          Not equals operator.
 void useFirstColumnOnly()
          Method to change the expression to use only the first column.
 
Methods inherited from class org.datanucleus.store.rdbms.sql.expression.SQLExpression
add, and, checkForAndCorrectParameterComparison, com, div, encloseInParentheses, eor, ge, getJavaTypeMapping, getNumberOfSubExpressions, getSQLStatement, getSQLTable, gt, invoke, ior, isParameter, le, lt, mod, mul, neg, not, sub, toSQLText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectExpression

public ObjectExpression(SQLStatement stmt,
                        SQLTable table,
                        org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
Constructor for an SQL expression for a (field) mapping in a specified table.

Parameters:
stmt - The statement
table - The table in the statement
mapping - The mapping for the field
Method Detail

useFirstColumnOnly

public void useFirstColumnOnly()
Method to change the expression to use only the first column. This is used where we want to use the expression with COUNT(...) and that only allows 1 column.


eq

public BooleanExpression eq(SQLExpression expr)
Equals operator. Called when the query contains "obj == value" where "obj" is this object.

Overrides:
eq in class SQLExpression
Parameters:
expr - The expression we compare with (the right-hand-side in the query)
Returns:
Boolean expression representing the comparison.

ne

public BooleanExpression ne(SQLExpression expr)
Not equals operator. Called when the query contains "obj != value" where "obj" is this object.

Overrides:
ne in class SQLExpression
Parameters:
expr - The expression we compare with (the right-hand-side in the query)
Returns:
Boolean expression representing the comparison.

in

public BooleanExpression in(SQLExpression expr)
Description copied from class: SQLExpression
In expression. Return true if this is contained by expr

Overrides:
in in class SQLExpression
Parameters:
expr - the right-hand expression
Returns:
true if the left-hand expression is contained by the right-hand expression. Otherwise the result is false.

cast

public SQLExpression cast(SQLExpression expr)
Cast operator. Called when the query contains "(type)obj" where "obj" is this object.

Overrides:
cast in class SQLExpression
Parameters:
expr - Expression representing the type to cast to
Returns:
Scalar expression representing the cast object.

is

public BooleanExpression is(SQLExpression expr)
An "is" (instanceOf) expression, providing a BooleanExpression whether this expression is an instanceof the provided type.

Overrides:
is in class SQLExpression
Parameters:
expr - The expression representing the type
Returns:
Whether this expression is an instance of the provided type


Copyright © 2009. All Rights Reserved.