public abstract class Expression extends Object
Constructor and Description |
---|
Expression() |
Modifier and Type | Method and Description |
---|---|
abstract Class |
getExpectedReturnType(Query q)
Return the class of the object that "should" be returned from a call to the:
getValue(Object,Query) method. |
abstract Object |
getValue(Object o,
Query q)
Get the value for this expression based upon the object passed in.
|
abstract boolean |
hasFixedResult(Query q)
Return whether the expression will evaluate to a fixed/constant result.
|
abstract void |
init(Query q)
Perform the necessary initialisation for this expression.
|
boolean |
isBracketed() |
abstract 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. |
void |
setBracketed(boolean v) |
abstract String |
toString()
Return a string representation of the expression, making this abstract forces
sub-classes to provide an implementation.
|
public abstract boolean isTrue(Object o, Query q) throws QueryExecutionException
ValueExpression
)
to be used in the WHERE and HAVING clauses but ensuring that a boolean value is
available for every expression.o
- The current object to evaluate the expression on.q
- The Query object.true
if the expression evaluates to true
(well duh...).QueryExecutionException
- If there is a problem with the execution of the
expression.public abstract boolean hasFixedResult(Query q)
isTrue(Object,Query)
or getValue(Object,Query)
methods will return the same object (or that o1.equals (o2) == true)
regardless of the object passed to the method.q
- The Query object.true
if the expression evaluates to a fixed/constant result.public void setBracketed(boolean v)
public boolean isBracketed()
public abstract Class getExpectedReturnType(Query q) throws QueryParseException
getValue(Object,Query)
method. It may be that repeated executions
of a query will return different classes from this method. In general
sub-classes should take this variance into account.q
- The Query object.getValue(Object,Query)
method.QueryParseException
- If something goes wrong with determining the type.public abstract void init(Query q) throws QueryParseException
q
- The Query object.QueryParseException
- If something goes wrong with the initialisation.public abstract Object getValue(Object o, Query q) throws QueryExecutionException
o
- The current object that the expression should be evaluated on.q
- The Query object.QueryExecutionException
- If something goes wrong with gaining the value.