org.castor.cpa.persistence.sql.query.condition
Class Compare

java.lang.Object
  extended by org.castor.cpa.persistence.sql.query.QueryObject
      extended by org.castor.cpa.persistence.sql.query.condition.Condition
          extended by org.castor.cpa.persistence.sql.query.condition.Compare

public final class Compare
extends Condition

Compare 2 conditions with an operator.

Version:
$Revision$ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Ahmad Hassan, Ralf Joachim

Constructor Summary
Compare(Expression left, CompareOperator operator, Expression right)
          Constructor a compare condition that compares given left and rigth hand operand with given comparison operator.
 
Method Summary
 Expression leftExpression()
          Returns left operand of the comparison.
 Condition not()
          Builder method to invert a condition.
 CompareOperator operator()
          Returns operator of comparison.
 Expression rightExpression()
          Returns right operand of the comparison.
 void toString(QueryContext ctx)
          Append a string representation of the object to the given QueryContext.
 
Methods inherited from class org.castor.cpa.persistence.sql.query.condition.Condition
and, or
 
Methods inherited from class org.castor.cpa.persistence.sql.query.QueryObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Compare

public Compare(Expression left,
               CompareOperator operator,
               Expression right)
Constructor a compare condition that compares given left and rigth hand operand with given comparison operator.

Parameters:
left - Left operand of the comparison.
operator - Operator of comparison.
right - Right operand of the comparison.
Method Detail

leftExpression

public Expression leftExpression()
Returns left operand of the comparison.

Returns:
Left operand of the comparison.

operator

public CompareOperator operator()
Returns operator of comparison.

Returns:
Operator of comparison.

rightExpression

public Expression rightExpression()
Returns right operand of the comparison.

Returns:
right operand of the comparison.

not

public Condition not()
Description copied from class: Condition
Builder method to invert a condition. A condition that evaluated to TRUE before calling this method will evaluate to FALSE thereafter.

Specified by:
not in class Condition
Returns:
Negated condition.

toString

public void toString(QueryContext ctx)
Description copied from class: QueryObject
Append a string representation of the object to the given QueryContext. In general, this toString method appends a string that "textually represents" this object. The result should be a string in valid SQL syntax. It is required that all subclasses override this method.

Specified by:
toString in class QueryObject
Parameters:
ctx - QueryContext to append the string representation of the object to.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com