org.apache.openjpa.jdbc.kernel.exps
Class CompareEqualExpression

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.exps.CompareEqualExpression
All Implemented Interfaces:
Serializable, Exp, Expression
Direct Known Subclasses:
EqualExpression, NotEqualExpression

abstract class CompareEqualExpression
extends Object
implements Exp

Compares two values for equality.

Author:
Abe White

Constructor Summary
CompareEqualExpression(Val val1, Val val2)
          Constructor.
 
Method Summary
 void acceptVisit(ExpressionVisitor visitor)
          Accept a visit from a tree visitor.
protected abstract  void appendTo(Select sel, ExpContext ctx, BinaryOpExpState state, SQLBuffer buf, boolean val1Null, boolean val2Null)
          Append the SQL for the comparison.
 void appendTo(Select sel, ExpContext ctx, ExpState state, SQLBuffer buf)
          Append the SQL for this expression to the given buffer.
 Val getValue1()
           
 Val getValue2()
           
 ExpState initialize(Select sel, ExpContext ctx, Map contains)
          Initialize the expression.
protected  boolean isDirectComparison()
          Subclasses can override this method if, when they compare to another, value, the comparison is indirect.
 void selectColumns(Select sel, ExpContext ctx, ExpState state, boolean pks)
          Select just the columns for this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompareEqualExpression

public CompareEqualExpression(Val val1,
                              Val val2)
Constructor. Supply values to compare.

Method Detail

getValue1

public Val getValue1()

getValue2

public Val getValue2()

initialize

public ExpState initialize(Select sel,
                           ExpContext ctx,
                           Map contains)
Description copied from interface: Exp
Initialize the expression. This method should recursively initialize any sub-expressions or values.

Specified by:
initialize in interface Exp
contains - map of relation paths to the number of times the paths appear in a contains() expression; used to ensure paths used for contains() within the same AND expression used different aliases

appendTo

public void appendTo(Select sel,
                     ExpContext ctx,
                     ExpState state,
                     SQLBuffer buf)
Description copied from interface: Exp
Append the SQL for this expression to the given buffer. The SQL should optionally include any joins this expression needs.

Specified by:
appendTo in interface Exp

selectColumns

public void selectColumns(Select sel,
                          ExpContext ctx,
                          ExpState state,
                          boolean pks)
Description copied from interface: Exp
Select just the columns for this expression.

Specified by:
selectColumns in interface Exp

appendTo

protected abstract void appendTo(Select sel,
                                 ExpContext ctx,
                                 BinaryOpExpState state,
                                 SQLBuffer buf,
                                 boolean val1Null,
                                 boolean val2Null)
Append the SQL for the comparison.


isDirectComparison

protected boolean isDirectComparison()
Subclasses can override this method if, when they compare to another, value, the comparison is indirect. For example, field.contains (x) should compare element values to null, not the field itself.


acceptVisit

public void acceptVisit(ExpressionVisitor visitor)
Description copied from interface: Expression
Accept a visit from a tree visitor.

Specified by:
acceptVisit in interface Expression


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.