FileDocCategorySizeDatePackage
SizeNode.javaAPI DocGlassfish v2 API3518Tue May 22 16:54:40 BST 2007oracle.toplink.essentials.internal.parsing

SizeNode

public class SizeNode extends ArithmeticFunctionNode
INTERNAL

Purpose: Represent a SIZE function

Responsibilities:

  • Generate the correct expression for SIZE

Fields Summary
Constructors Summary
public SizeNode()
Return a new SizeNode.

        super();
    
Methods Summary
public oracle.toplink.essentials.expressions.ExpressiongenerateExpression(oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Generate the TopLink expression for this node

        DotNode dotNode = (DotNode)getLeft();
        Node prefix = dotNode.getLeft();
        String variableName = ((AttributeNode)dotNode.getRight()).getAttributeName();

        // check whether variable denotes a collection valued field
        if (!dotNode.endsWithCollectionField(context)) {
            throw EJBQLException.invalidSizeArgument(
                context.getParseTreeContext().getQueryInfo(), 
                getLine(), getColumn(), variableName);
        }
        Expression whereClause = prefix.generateExpression(context);
        whereClause = whereClause.size(variableName);
        return whereClause;
    
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.getIntType());