org.datanucleus.store.mapped.expression
Class AggregateExpression

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

public class AggregateExpression
extends NumericExpression

Representation of aggregate functions in JDOQL.


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
protected AggregateExpression(JavaTypeMapping mapping, java.lang.String functionName, java.util.List args, boolean distinct)
           
  AggregateExpression(QueryExpression qs)
          Constructor
 
Method Summary
 ScalarExpression avgMethod(ScalarExpression expr)
          Returns the average value of the argument.
 ScalarExpression countMethod(ScalarExpression expr)
          Returns the count value of the argument.
 ScalarExpression maxMethod(ScalarExpression expr)
          Returns the max value of the argument.
 ScalarExpression minMethod(ScalarExpression expr)
          Returns the max value of the argument.
 void setDistinct()
          Method to enable use of DISTINCT on the aggregate field column
 ScalarExpression sumMethod(ScalarExpression expr)
          Returns the sum value of the argument.
 
Methods inherited from class org.datanucleus.store.mapped.expression.NumericExpression
add, com, div, eq, gt, gteq, in, lt, lteq, mod, mul, neg, noteq, sub
 
Methods inherited from class org.datanucleus.store.mapped.expression.ScalarExpression
accessField, and, as, assertValidTypeForParameterComparison, callMethod, cast, checkForTypeAssignability, encloseWithInParentheses, eor, equals, getAlias, getConsistentTypeForParameterComparison, getExpressionList, getLogicSetExpression, getMapping, getNonAliasExpression, getQueryExpression, instanceOf, ior, not, setParameterName, toStatementText, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AggregateExpression

public AggregateExpression(QueryExpression qs)
Constructor

Parameters:
qs - The query statement

AggregateExpression

protected AggregateExpression(JavaTypeMapping mapping,
                              java.lang.String functionName,
                              java.util.List args,
                              boolean distinct)
Method Detail

setDistinct

public void setDistinct()
Method to enable use of DISTINCT on the aggregate field column


maxMethod

public ScalarExpression maxMethod(ScalarExpression expr)
Returns the max value of the argument.

Parameters:
expr - the expression
Returns:
the result in a ScalarExpression instance

minMethod

public ScalarExpression minMethod(ScalarExpression expr)
Returns the max value of the argument.

Parameters:
expr - the expression
Returns:
the result in a ScalarExpression instance

sumMethod

public ScalarExpression sumMethod(ScalarExpression expr)
Returns the sum value of the argument.

Parameters:
expr - the expression
Returns:
the result in a ScalarExpression instance

avgMethod

public ScalarExpression avgMethod(ScalarExpression expr)
Returns the average value of the argument.

Parameters:
expr - the expression
Returns:
the result in a ScalarExpression instance

countMethod

public ScalarExpression countMethod(ScalarExpression expr)
Returns the count value of the argument.

Parameters:
expr - the expression
Returns:
the result in a ScalarExpression instance


Copyright © 2010. All Rights Reserved.