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

EmptyCollectionComparisonNode

public class EmptyCollectionComparisonNode extends SimpleConditionalExpressionNode
INTERNAL

Purpose: Used for the EMPTY collection handling

Responsibilities:

  • Generate the correct expression for an IS EMPTY in EJBQL
author
Jon Driscoll and Joel Lucuik
since
August 2003

Fields Summary
public boolean
notIndicated
Constructors Summary
public EmptyCollectionComparisonNode()
EmptyCollectionComparisonNode 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.

        //get the variable name from the DotNode's right attribute
        //...WHERE emp.firstName IS EMPTY
        String emptyAttributeName = ((AttributeNode)getLeft().getRight()).getAttributeName();
        Expression whereClause = getLeft().getLeft().generateExpression(context);
        if (notIndicated) {
            return whereClause.notEmpty(emptyAttributeName);
        } else {
            return whereClause.isEmpty(emptyAttributeName);
        }
    
public voidindicateNot()
INTERNAL Indicate if a NOT was found in the WHERE clause. Examples: ...WHERE emp.phoneNumbers IS NOT EMPTY

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

        if (left != null) {
            left.validate(context);
        }
        TypeHelper typeHelper = context.getTypeHelper();
        setType(typeHelper.getBooleanType());