|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.josql.expressions.Expression org.josql.expressions.ValueExpression org.josql.expressions.ExpressionList
public class ExpressionList
This class represents a list of expressions used within a SQL statement.
Expressions lists are created using pairs of "[]" brackets, i.e.
[toString, 10, true]Would create a list of expressions that should be treated as a unit.
Since expression lists are also expressions it is possible to nest them to the nth degree, if desired. i.e.
[toString, [1, 2, 3, 4], [true, true]]
Constructor Summary | |
---|---|
ExpressionList()
|
Method Summary | |
---|---|
void |
addExpression(Expression expr)
Add an expression to the list. |
Object |
evaluate(Object o,
Query q)
Evaluates the value of this expression list. |
Class |
getExpectedReturnType(Query q)
Get the expected return type, which is List . |
List |
getExpressions()
Returns the expressions, a list of Expression objects. |
Object |
getValue(Object o,
Query q)
Gets the value of the expressions, this will return a list of the values for each of the expressions in the list. |
boolean |
hasFixedResult(Query q)
Returns true if this expression list is empty (no expressions) or
if ALL of the expressions have a fixed result. |
void |
init(Query q)
Initialises this expression list, each expression in the list is inited. |
boolean |
isTrue(Object o,
Query q)
Returns true if one of the expression values is non-null. |
void |
setExpressions(List exprs)
Set the expressions. |
String |
toString()
Returns a string version of this expression list. |
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 |
---|
public ExpressionList()
Method Detail |
---|
public Class getExpectedReturnType(Query q)
List
.
getExpectedReturnType
in class Expression
q
- The Query object.
List
.public void init(Query q) throws QueryParseException
init
in class Expression
q
- The Query object.
QueryParseException
- If one of the expressions cannot be inited.public List getExpressions()
Expression
objects.
public void addExpression(Expression expr)
expr
- The expression.public void setExpressions(List exprs)
exprs
- The expressions.public Object getValue(Object o, Query q) throws QueryExecutionException
Expression.getValue(Object,Query)
is called on each of the expressions.
getValue
in class ValueExpression
o
- The current object.q
- The Query object.
QueryExecutionException
- If something goes wrong the acquisition of the values.public boolean isTrue(Object o, Query q) throws QueryExecutionException
true
if one of the expression values is non-null.
Note: for efficiency this method calls Expression.getValue(Object,Query)
on each expression directly and returns true
for the first non-null
value found, as such if any of your expressions triggers side-effects then this
method should not be used.
isTrue
in class Expression
o
- The current object.q
- The Query object.
true
if one of the expression values is non-null.
QueryExecutionException
- If a problem occurs during evaluation.public Object evaluate(Object o, Query q) throws QueryExecutionException
getValue(Object,Query)
.
evaluate
in class ValueExpression
o
- The current object.q
- The Query object.
QueryExecutionException
- If there is a problem getting the values.public String toString()
toString
in class Expression
public boolean hasFixedResult(Query q)
true
if this expression list is empty (no expressions) or
if ALL of the expressions have a fixed result.
hasFixedResult
in class Expression
q
- The Query object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |