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

SubstringNode

public class SubstringNode extends StringFunctionNode
INTERNAL

Purpose: Represent a SUBSTRING

Responsibilities:

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

Fields Summary
private Node
startPosition
private Node
stringLength
Constructors Summary
public SubstringNode()
SubstringNode constructor comment.


            
      
        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 = getLeft().generateExpression(context);
        Expression startPosition = getStartPosition().generateExpression(context);
        Expression stringLength = getStringLength().generateExpression(context);
        whereClause = whereClause.substring(startPosition, stringLength);
        return whereClause;
    
private oracle.toplink.essentials.internal.parsing.NodegetStartPosition()
Return the start position object

        return startPosition;
    
private oracle.toplink.essentials.internal.parsing.NodegetStringLength()
Return the string length object

        return stringLength;
    
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 (left != null) {
           left = left.qualifyAttributeAccess(context);
       }
       if (startPosition != null) {
           startPosition = startPosition.qualifyAttributeAccess(context);
       }
       if (stringLength != null) {
           stringLength = stringLength.qualifyAttributeAccess(context);
       }
       return this;
    
public voidsetStartPosition(oracle.toplink.essentials.internal.parsing.Node newStartPosition)
Insert the method's description here. Creation date: (1/19/01 3:41:55 PM)

param
newStartPosition java.lang.Integer

        startPosition = newStartPosition;
    
public voidsetStringLength(oracle.toplink.essentials.internal.parsing.Node newStringLength)
Insert the method's description here. Creation date: (1/19/01 3:42:26 PM)

param
newStringLength java.lang.Integer

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

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