org.datanucleus.store.mapped.expression
Class MapExpression

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

public class MapExpression
extends ScalarExpression

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

When navigated through using containsKey(expr) the keys of the Map are relationally joined onto the query statement. When navigated through using containsValue(expr) the values of the Map are relationally joined onto the query statement. These 2 methods are required for JDO 2.0, whilst the isEmpty() and contains() are JDO 1.0.1. containsEntry() is a JPOX extension.

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
MapExpression(QueryExpression qs, JavaTypeMapping mapping, LogicSetExpression te, MapStore mapStore, java.lang.String fieldName)
          Constructor.
 
Method Summary
 BooleanExpression containsEntryMethod(ScalarExpression keyExpr, ScalarExpression valueExpr)
          Executed when the containsEntry() method is found in a query filter.
 BooleanExpression containsKeyMethod(ScalarExpression expr)
          Executed when the containsKey() method is found in a query filter.
 BooleanExpression containsMethod(ScalarExpression expr)
          Executed when a contains() method is found in a query filter.
 BooleanExpression containsValueMethod(ScalarExpression expr)
          Executed when the containsValue() method is found in a query filter.
 ScalarExpression getMethod(ScalarExpression expr)
          Method to get a value from the Map for a key
 BooleanExpression isEmptyMethod()
          Return the BooleanExpression for a query filter in the form "map.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, eq, 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

MapExpression

public MapExpression(QueryExpression qs,
                     JavaTypeMapping mapping,
                     LogicSetExpression te,
                     MapStore mapStore,
                     java.lang.String fieldName)
Constructor.

Parameters:
qs - The Query Statement
mapping - The java field mapping
te - The Table Expression
mapStore - the backing store.
fieldName - Name of the field for the map.
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.

containsKeyMethod

public BooleanExpression containsKeyMethod(ScalarExpression expr)
Executed when the containsKey() method is found in a query filter. This is added in JDO 2.0.

Parameters:
expr - The ScalarExpression param for map.containsKey(...).
Returns:
The BooleanExpression resulting from map.containsKey().

containsEntryMethod

public BooleanExpression containsEntryMethod(ScalarExpression keyExpr,
                                             ScalarExpression valueExpr)
Executed when the containsEntry() method is found in a query filter. This is a JPOX extension to JDOQL 1.0.1/2.0.

Parameters:
keyExpr - The ScalarExpression param for map.containsEntry(...).
valueExpr - The ScalarExpression param for map.containsEntry(...).
Returns:
The BooleanExpression resulting from map.containsEntry().

containsMethod

public BooleanExpression containsMethod(ScalarExpression expr)
Executed when a contains() method is found in a query filter. This simply uses the containsValueMethod() to check against values.

Parameters:
expr - The ScalarExpression param for map.contains(...).
Returns:
The BooleanExpression resulting from map.contains().

containsValueMethod

public BooleanExpression containsValueMethod(ScalarExpression expr)
Executed when the containsValue() method is found in a query filter. This is added in JDO 2.0.

Parameters:
expr - The ScalarExpression param for map.containsValue(...).
Returns:
The BooleanExpression resulting from map.containsValue().

isEmptyMethod

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

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

getMethod

public ScalarExpression getMethod(ScalarExpression expr)
Method to get a value from the Map for a key

Parameters:
expr - The key argument expression
Returns:
The statement

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.