org.datanucleus.store.mapped.expression
Class CollectionExpression

java.lang.Object
  extended by org.datanucleus.store.mapped.expression.ScalarExpression
      extended by org.datanucleus.store.mapped.expression.CollectionExpression

public class CollectionExpression
extends ScalarExpression

An expression that represents some collection field in a query candidate class, or a collection field in an object linked from the candidate class by navigation.

When navigated through using contains(expr), the elements of the collection are relationally joined onto the query statement.

As this is a Collection Expression it works equally for Sets and Lists, and we use CollectionStore as the backing store interface, so that ListStore and SetStore are equally applicable.

Version:
$Revision: 1.33 $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.expression.ScalarExpression
ScalarExpression.DatastoreFieldExpression, ScalarExpression.DyadicOperator, ScalarExpression.ExpressionList, ScalarExpression.IllegalArgumentTypeException, ScalarExpression.IllegalOperationException, ScalarExpression.MethodInvocationException, ScalarExpression.MonadicOperator, ScalarExpression.Operator
 
Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.expression.ScalarExpression
aliasIdentifier, checkForTypeAssignability, expressionList, FILTER, LOCALISER, lowestOperator, mapping, OP_ADD, OP_AND, OP_BETWEEN, OP_COM, OP_CONCAT, OP_DIV, OP_EQ, OP_GT, OP_GTEQ, OP_IN, OP_IS, OP_ISNOT, OP_LIKE, OP_LT, OP_LTEQ, OP_MOD, OP_MUL, OP_NEG, OP_NOT, OP_NOTEQ, OP_NOTIN, OP_NOTLIKE, OP_OR, OP_SUB, parameterName, PROJECTION, qs, st, te
 
Constructor Summary
CollectionExpression(QueryExpression qs, JavaTypeMapping ownerMapping, LogicSetExpression te, CollectionStore collStore, java.lang.String fieldName)
          Constructor.
 
Method Summary
 BooleanExpression containsMethod(ScalarExpression expr)
          Executed when the contains() method is found in a query filter.
 BooleanExpression eq(ScalarExpression expr)
          Method to return the expression for comparing a collection with a value.
 BooleanExpression isEmptyMethod()
          Return the BooleanExpression for a query filter in the form "collection.isEmpty()".
 NumericExpression sizeMethod()
          Executed when the size() method is found in a query filter.
 StatementText toStatementText(int mode)
          Method to return the statement text.
 
Methods inherited from class org.datanucleus.store.mapped.expression.ScalarExpression
accessField, add, and, as, assertValidTypeForParameterComparison, callMethod, cast, checkForTypeAssignability, com, div, encloseWithInParentheses, eor, equals, getAlias, getConsistentTypeForParameterComparison, getExpressionList, getLogicSetExpression, getMapping, getNonAliasExpression, getQueryExpression, gt, gteq, in, instanceOf, ior, lt, lteq, mod, mul, neg, not, noteq, setParameterName, sub, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionExpression

public CollectionExpression(QueryExpression qs,
                            JavaTypeMapping ownerMapping,
                            LogicSetExpression te,
                            CollectionStore collStore,
                            java.lang.String fieldName)
Constructor.

Parameters:
qs - The Query Statement
ownerMapping - The mapping to the owner of this collection
te - The Table Expression
collStore - the backing store.
fieldName - Name of the field for the collection.
Method Detail

sizeMethod

public NumericExpression sizeMethod()
Executed when the size() method is found in a query filter.

Returns:
The NumericExpression resulting from the size() method.

containsMethod

public BooleanExpression containsMethod(ScalarExpression expr)
Executed when the contains() method is found in a query filter.

Parameters:
expr - The ScalarExpression passed as a parameter to contains().
Returns:
The BooleanExpression resulting from the contains() method.

isEmptyMethod

public BooleanExpression isEmptyMethod()
Return the BooleanExpression for a query filter in the form "collection.isEmpty()".

Returns:
The BooleanExpression for a query filter in the form "collection.isEmpty()".

eq

public BooleanExpression eq(ScalarExpression expr)
Method to return the expression for comparing a collection with a value. JPOX only supports comparisons with null currently.

Overrides:
eq in class ScalarExpression
Parameters:
expr - The value to compare with.
Returns:
The expression of equality

toStatementText

public StatementText toStatementText(int mode)
Method to return the statement text.

Overrides:
toStatementText in class ScalarExpression
Parameters:
mode - (0=PROJECTION;1=FILTER)
Returns:
The statement
Throws:
NucleusUserException - since this object is inaccessible directly.


Copyright © 2010. All Rights Reserved.