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

LocateNode

public class LocateNode extends ArithmeticFunctionNode
INTERNAL

Purpose: Represent a LOCATE

Responsibilities:

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

Fields Summary
private Node
find
private Node
findIn
private Node
startPosition
Constructors Summary
public LocateNode()
Return a new LocateNode.


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

        Expression whereClause = getFindIn().generateExpression(context);
        Expression findExpr = getFind().generateExpression(context);
        if (startPosition != null) {
            whereClause = whereClause.locate(findExpr, getStartPosition().generateExpression(context));
        } else {
            whereClause = whereClause.locate(findExpr);
        }
        return whereClause;
    
public oracle.toplink.essentials.internal.parsing.NodegetFind()

        return find;
    
public oracle.toplink.essentials.internal.parsing.NodegetFindIn()

        return findIn;
    
public oracle.toplink.essentials.internal.parsing.NodegetStartPosition()

        return startPosition;
    
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 so, replace them by a qualified field access.

       if (find != null) {
           find = find.qualifyAttributeAccess(context);
       }
       if (findIn != null) {
           findIn = findIn.qualifyAttributeAccess(context);
       }
       if (startPosition != null) {
           startPosition = startPosition.qualifyAttributeAccess(context);
       }
       return this;
    
public voidsetFind(oracle.toplink.essentials.internal.parsing.Node newFind)

        find = newFind;
    
public voidsetFindIn(oracle.toplink.essentials.internal.parsing.Node newFindIn)

        findIn = newFindIn;
    
public voidsetStartPosition(oracle.toplink.essentials.internal.parsing.Node newStartPosition)

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

        TypeHelper typeHelper = context.getTypeHelper();
        if (findIn != null) {
            findIn.validate(context);
            findIn.validateParameter(context, typeHelper.getStringType());
        }
        if (find != null) {
            find.validate(context);
            find.validateParameter(context, typeHelper.getStringType());
        }
        if (startPosition != null) {
            startPosition.validate(context);
            startPosition.validateParameter(context, typeHelper.getIntType());
        }
        setType(typeHelper.getIntType());