FileDocCategorySizeDatePackage
CountNode.javaAPI DocGlassfish v2 API3638Tue May 22 16:54:36 BST 2007oracle.toplink.essentials.internal.parsing

CountNode

public class CountNode extends AggregateNode
INTERNAL

Purpose: Model a COUNT

Responsibilities:

  • Apply itself to a query correctly
author
Jon Driscoll
since
TopLink 5.0

Fields Summary
Constructors Summary
Methods Summary
protected oracle.toplink.essentials.expressions.ExpressionaddAggregateExression(oracle.toplink.essentials.expressions.Expression expr)
INTERNAL

        return expr.count();
    
public voidapplyToQuery(oracle.toplink.essentials.queryframework.ObjectLevelReadQuery theQuery, oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Apply this node to the passed query

        if (theQuery.isReportQuery()) {
            ReportQuery reportQuery = (ReportQuery)theQuery;
            String attrName = getLeft().isDotNode() ? resolveAttribute() : "COUNT";
            reportQuery.addAttribute(attrName, generateExpression(context), Long.class);
        }
    
public java.lang.StringgetAsString()
INTERNAL Get the string representation of this node.

        return "COUNT(" + left.getAsString() + ")";
    
public booleanisCountNode()
INTERNAL Is this node a CountNode

        return true;
    
public voidvalidate(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Validate node and calculate its type.

        if (left != null) {
            left.validate(context);
            TypeHelper typeHelper = context.getTypeHelper();
            setType(typeHelper.getLongClassType());
        }