| java.lang.Object org.josql.expressions.Expression org.josql.expressions.ValueExpression org.josql.expressions.ExpressionList
ExpressionList | public class ExpressionList extends ValueExpression (Code) | | 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]]
|
Method Summary | |
public void | addExpression(Expression expr) Add an expression to the list. | public Object | evaluate(Object o, Query q) Evaluates the value of this expression list. | public Class | getExpectedReturnType(Query q) Get the expected return type, which is
List .
Parameters: q - The Query object. | public List | getExpressions() Returns the expressions, a list of
Expression objects. | public 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. | public boolean | hasFixedResult(Query q) Returns true if this expression list is empty (no expressions) or
if ALL of the expressions have a fixed result.
Parameters: q - The Query object. | public void | init(Query q) Initialises this expression list, each expression in the list is inited. | public boolean | isTrue(Object o, Query q) Returns true if one of the expression values is non-null.
Note: for efficiency this method calls
Expression.getValue(ObjectQuery) 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.
Parameters: o - The current object. | public void | setExpressions(List exprs) Set the expressions. | public String | toString() Returns a string version of this expression list. |
addExpression | public void addExpression(Expression expr)(Code) | | Add an expression to the list.
Parameters: expr - The expression. |
getExpectedReturnType | public Class getExpectedReturnType(Query q)(Code) | | Get the expected return type, which is
List .
Parameters: q - The Query object. List. |
getExpressions | public List getExpressions()(Code) | | Returns the expressions, a list of
Expression objects.
The expressions. |
getValue | public Object getValue(Object o, Query q) throws QueryExecutionException(Code) | | Gets the value of the expressions, this will return a list of the values for
each of the expressions in the list. In essence
Expression.getValue(ObjectQuery) is called on each of the expressions.
Parameters: o - The current object. Parameters: q - The Query object. A list of the values, if there are no expressions in the list then an empty list is returned. throws: QueryExecutionException - If something goes wrong the acquisition of the values. |
hasFixedResult | public boolean hasFixedResult(Query q)(Code) | | Returns true if this expression list is empty (no expressions) or
if ALL of the expressions have a fixed result.
Parameters: q - The Query object. See description. |
isTrue | public boolean isTrue(Object o, Query q) throws QueryExecutionException(Code) | | Returns true if one of the expression values is non-null.
Note: for efficiency this method calls
Expression.getValue(ObjectQuery) 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.
Parameters: o - The current object. Parameters: q - The Query object. true if one of the expression values is non-null. throws: QueryExecutionException - If a problem occurs during evaluation. |
setExpressions | public void setExpressions(List exprs)(Code) | | Set the expressions.
Parameters: exprs - The expressions. |
toString | public String toString()(Code) | | Returns a string version of this expression list.
Returns in the form: "[" Expression [ , Expression ]* "]".
A string version of the expression list. |
|
|