| java.lang.Object org.josql.expressions.Expression
All known Subclasses: org.josql.expressions.SelectItemExpression, org.josql.expressions.ValueExpression, org.josql.expressions.BinaryExpression, org.josql.expressions.AliasedExpression,
Expression | abstract public class Expression (Code) | | The base class for all expressions.
|
Method Summary | |
abstract public Class | getExpectedReturnType(Query q) Return the class of the object that "should" be returned from a call to the:
Expression.getValue(Object,Query) method. | abstract public Object | getValue(Object o, Query q) Get the value for this expression based upon the object passed in. | abstract public boolean | hasFixedResult(Query q) Return whether the expression will evaluate to a fixed/constant result.
This allows certain optimisations to be performed when an expression is
evaluated. | abstract public void | init(Query q) Perform the necessary initialisation for this expression. | public boolean | isBracketed() | abstract public boolean | isTrue(Object o, Query q) This method allows ANY expression (including those that extend
ValueExpression )
to be used in the WHERE and HAVING clauses but ensuring that a boolean value is
available for every expression.
Parameters: o - The current object to evaluate the expression on. Parameters: q - The Query object. | public void | setBracketed(boolean v) | abstract public String | toString() Return a string representation of the expression, making this abstract forces
sub-classes to provide an implementation. |
getValue | abstract public Object getValue(Object o, Query q) throws QueryExecutionException(Code) | | Get the value for this expression based upon the object passed in. In general
sub-classes should perform some operation on the object to generate their result.
The Query object is provided so that sub-classes can gain access to the
bind variables (if required), save values and so on.
Whilst it may seem better to have the Query object as a member of this class
this would then prevent the expression from being used separately from the Query
(a design goal of JoSQL, i.e. independent processing).
Parameters: o - The current object that the expression should be evaluated on. Parameters: q - The Query object. The value of the expression. throws: QueryExecutionException - If something goes wrong with gaining the value. |
hasFixedResult | abstract public boolean hasFixedResult(Query q)(Code) | | Return whether the expression will evaluate to a fixed/constant result.
This allows certain optimisations to be performed when an expression is
evaluated. A "fixed result" is basically one in which multiple calls to
either the:
Expression.isTrue(Object,Query) or
Expression.getValue(Object,Query) methods will return the same object (or that o1.equals (o2) == true)
regardless of the object passed to the method.
Parameters: q - The Query object. true if the expression evaluates to a fixed/constant result. |
init | abstract public void init(Query q) throws QueryParseException(Code) | | Perform the necessary initialisation for this expression.
The exact operations performed are defined by the sub-class.
Parameters: q - The Query object. throws: QueryParseException - If something goes wrong with the initialisation. |
isBracketed | public boolean isBracketed()(Code) | | |
isTrue | abstract public boolean isTrue(Object o, Query q) throws QueryExecutionException(Code) | | This method allows ANY expression (including those that extend
ValueExpression )
to be used in the WHERE and HAVING clauses but ensuring that a boolean value is
available for every expression.
Parameters: o - The current object to evaluate the expression on. Parameters: q - The Query object. true if the expression evaluates to true (well duh...). throws: QueryExecutionException - If there is a problem with the execution of the expression. |
setBracketed | public void setBracketed(boolean v)(Code) | | |
toString | abstract public String toString()(Code) | | Return a string representation of the expression, making this abstract forces
sub-classes to provide an implementation.
A string representation of the expression. |
|
|