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

BetweenNode

public class BetweenNode extends SimpleConditionalExpressionNode
INTERNAL

Purpose: Represent a BETWEEN in EJBQL

Responsibilities:

  • Generate the correct expression for a BETWEEN in EJBQL
author
Jon Driscoll and Joel Lucuik
since
TopLink 4.0

Fields Summary
protected Node
rightForBetween
protected Node
rightForAnd
Constructors Summary
public BetweenNode()
BetweenNode constructor comment.

        super();
    
Methods Summary
public oracle.toplink.essentials.expressions.ExpressiongenerateExpression(oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Return a TopLink expression by 'BETWEEN' and 'AND'ing the expressions from the left, rightForBetween and rightForAnd nodes

        // Get the left expression
        Expression whereClause = getLeft().generateExpression(context);

        // Between it with whatever the rightForBetween expression and rightForAnd expressions are
        whereClause = whereClause.between(getRightForBetween().generateExpression(context), getRightForAnd().generateExpression(context));

        // and return the expression...
        return whereClause;
    
public oracle.toplink.essentials.internal.parsing.NodegetRightForAnd()

        return rightForAnd;
    
public oracle.toplink.essentials.internal.parsing.NodegetRightForBetween()

        return rightForBetween;
    
public booleanhasRightForAnd()

        return rightForAnd != null;
    
public booleanhasRightForBetween()

        return rightForBetween != null;
    
public oracle.toplink.essentials.internal.parsing.NodequalifyAttributeAccess(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Check the child nodes for an unqualified field access and if there are any, replace them by a qualified field access.

        if (left != null) {
            left = left.qualifyAttributeAccess(context);
        }
        if (rightForBetween != null) {
            rightForBetween = rightForBetween.qualifyAttributeAccess(context);
        }
        if (rightForAnd != null) {
            rightForAnd = rightForAnd.qualifyAttributeAccess(context);
        }
        return this;
    
public voidsetRightForAnd(oracle.toplink.essentials.internal.parsing.Node newRightForAnd)

        rightForAnd = newRightForAnd;
    
public voidsetRightForBetween(oracle.toplink.essentials.internal.parsing.Node newRightForBetween)

        rightForBetween = newRightForBetween;
    
public voidvalidate(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Validate node and calcualte its type.

        Object type = null;
        if (left != null) {
            left.validate(context);
            type = left.getType();
        }
        if (rightForBetween != null) {
            rightForBetween.validate(context);
            rightForBetween.validateParameter(context, type);
        }
        if (rightForAnd != null) {
            rightForAnd.validate(context);
            rightForAnd.validateParameter(context, type);
        }
        TypeHelper typeHelper = context.getTypeHelper();
        setType(typeHelper.getBooleanType());