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

LikeNode

public class LikeNode extends SimpleConditionalExpressionNode
INTERNAL

Purpose: Represent a LIKE in EJBQL

Responsibilities:

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

Fields Summary
private EscapeNode
escape
Constructors Summary
public LikeNode()
LikeNode constructor comment.


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

        Expression whereClause = getLeft().generateExpression(context);
        if (!hasEscape()) {
            whereClause = whereClause.like(getRight().generateExpression(context));
        } else {
            whereClause = whereClause.like(getRight().generateExpression(context), getEscapeNode().generateExpression(context));
        }
        return whereClause;
    
public oracle.toplink.essentials.internal.parsing.EscapeNodegetEscapeNode()

        return escape;
    
public booleanhasEscape()

        return getEscapeNode() != null;
    
public voidsetEscapeNode(oracle.toplink.essentials.internal.parsing.EscapeNode node)

        escape = node;
    
public voidvalidate(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Validate the current node and calculates its type.

        TypeHelper typeHelper = context.getTypeHelper();
        if (left != null) {
            left.validate(context);
            left.validateParameter(context, typeHelper.getStringType());
        }
        if (right != null) {
            right.validate(context);
            right.validateParameter(context, typeHelper.getStringType());
        } 
        
        if (escape != null) {
            escape.validate(context);
        }
        
        setType(typeHelper.getBooleanType());