FileDocCategorySizeDatePackage
OrderByItemNode.javaAPI DocGlassfish v2 API4406Tue May 22 16:54:38 BST 2007oracle.toplink.essentials.internal.parsing

OrderByItemNode

public class OrderByItemNode extends Node
INTERNAL

Purpose: This node represents an ORDER BY item

Responsibilities:

  • Generate the correct expression for ORDER BY
author
Jon Driscoll
since
OracleAS TopLink 10g (9.0.4)

Fields Summary
private SortDirectionNode
direction
private Node
orderByItem
Constructors Summary
Methods Summary
public oracle.toplink.essentials.expressions.ExpressiongenerateExpression(oracle.toplink.essentials.internal.parsing.GenerationContext context)

        //BUG 3105651: Indicate to the VariableNodes in the subtree
        //that they should check the SelectNode before resolving.
        //If the variable involved is SELECTed, then we want an empty builder
        //instead (with an empty constructor).
        boolean oldCheckState = context.shouldCheckSelectNodeBeforeResolving();
        ((SelectGenerationContext)context).checkSelectNodeBeforeResolving(true);
        Expression orderByExpression = getOrderByItem().generateExpression(context);
        orderByExpression = getDirection().addToExpression(orderByExpression, context);
        ((SelectGenerationContext)context).checkSelectNodeBeforeResolving(oldCheckState);
        return orderByExpression;
    
public oracle.toplink.essentials.internal.parsing.SortDirectionNodegetDirection()

        if (direction == null) {
            setDirection(new SortDirectionNode());
        }
        return direction;
    
public oracle.toplink.essentials.internal.parsing.NodegetOrderByItem()

        return orderByItem;
    
public voidsetDirection(oracle.toplink.essentials.internal.parsing.SortDirectionNode direction)

        this.direction = direction;
    
public voidsetOrderByItem(oracle.toplink.essentials.internal.parsing.Node orderByItem)

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


                
        
        TypeHelper typeHelper = context.getTypeHelper();
        if (orderByItem != null) {
            orderByItem.validate(context);
            Object type = orderByItem.getType();
            setType(type);
            if (!typeHelper.isOrderableType(type)) {
                throw EJBQLException.expectedOrderableOrderByItem(
                    context.getQueryInfo(), orderByItem.getLine(), orderByItem.getColumn(), 
                    orderByItem.getAsString(), typeHelper.getTypeName(type));
            }
        }