org.josql.expressions
Class BooleanExpression

java.lang.Object
  extended by org.josql.expressions.Expression
      extended by org.josql.expressions.ValueExpression
          extended by org.josql.expressions.BooleanExpression

public class BooleanExpression
extends ValueExpression

This class represents a "boolean" expression, either true or false.


Constructor Summary
BooleanExpression()
           
 
Method Summary
 Object evaluate(Object o, Query q)
          Get the value of this boolean.
 Class getExpectedReturnType(Query q)
          Get the expected return type.
 Object getValue(Object o, Query q)
          Get the value of this boolean.
 boolean hasFixedResult(Query q)
          Always returns true since it represents a constant.
 void init(Query q)
          Init this expression.
 boolean isTrue(Object o, Query q)
          Returns whether this expression is true or false.
 void setValue(Boolean b)
           
 String toString()
          Returns a string version of this expression.
 
Methods inherited from class org.josql.expressions.Expression
isBracketed, setBracketed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanExpression

public BooleanExpression()
Method Detail

hasFixedResult

public boolean hasFixedResult(Query q)
Always returns true since it represents a constant.

Specified by:
hasFixedResult in class Expression
Parameters:
q - The Query object.
Returns:
true always.

toString

public String toString()
Returns a string version of this expression. Basically returns: true | false.

Specified by:
toString in class Expression
Returns:
A string version of this expression.

getExpectedReturnType

public Class getExpectedReturnType(Query q)
Get the expected return type.

Specified by:
getExpectedReturnType in class Expression
Parameters:
q - The Query object.
Returns:
Always returns: java.lang.Boolean.TYPE.

init

public void init(Query q)
Init this expression. Actually does nothing since it is a constant.

Specified by:
init in class Expression
Parameters:
q - The Query object.

setValue

public void setValue(Boolean b)

isTrue

public boolean isTrue(Object o,
                      Query q)
Returns whether this expression is true or false.

Specified by:
isTrue in class Expression
Parameters:
o - The current object, not used in this method.
q - The Query object, not used in this method.
Returns:
The value of this expression.

getValue

public Object getValue(Object o,
                       Query q)
Get the value of this boolean.

Overrides:
getValue in class ValueExpression
Parameters:
o - The current object, not used in this method.
q - The Query object, not used in this method.
Returns:
The value of this expression.

evaluate

public Object evaluate(Object o,
                       Query q)
Get the value of this boolean.

Specified by:
evaluate in class ValueExpression
Parameters:
o - The current object, not used in this method.
q - The Query object, not used in this method.
Returns:
The value of this expression.


  Copyright © 2008 Gary Bentley. All Rights Reserved.