org.josql.expressions
Class InExpression
java.lang.Object
org.josql.expressions.Expression
org.josql.expressions.BinaryExpression
org.josql.expressions.InExpression
public class InExpression
- extends BinaryExpression
This class represents in [ NOT ] IN [ LIKE ] [ ALL ] expression.
If any of the values listed are Maps or Collections then they are iterated over to see if a match
is found. For Maps only the key values are checked. If you pass a list then it is iterated over
using a for
construct rather than an Iterator since it's much faster.
Note: due to the way that the expression is designed it is POSSIBLE to have a binary expression
in the in list, however at this time that is not supported since it can lead to an ambiguous result,
for example: true IN (true, false)
has no sensible meaning.
InExpression
public InExpression()
init
public void init(Query q)
throws QueryParseException
- Initialise the IN expression. Init the LHS and then all of the values in the brackets.
- Overrides:
init
in class BinaryExpression
- Parameters:
q
- The Query object.
- Throws:
QueryParseException
- If something goes wrong with the init.
setIgnoreCase
public void setIgnoreCase(boolean v)
isIgnoreCase
public boolean isIgnoreCase()
isAll
public boolean isAll()
setAll
public void setAll(boolean v)
isDoLike
public boolean isDoLike()
setDoLike
public void setDoLike(boolean d)
setItems
public void setItems(List items)
getItems
public List getItems()
addItem
public void addItem(Expression e)
isNot
public boolean isNot()
setNot
public void setNot(boolean v)
isTrue
public boolean isTrue(Object o,
Query q)
throws QueryExecutionException
- Return whether this expression evaulates to
true
. If any of the values on RHS are Maps (keys
only) or Collections then they are iterated over and checked against the LHS.
- Specified by:
isTrue
in class Expression
- Parameters:
o
- The current object to perform the expression on.q
- The Query object.
- Returns:
true
if the LHS is "equal" (as determined by: Utilities.isEquals(Object,Object)
)
to any of the values in the brackets. If this is a NOT expression then the result is negated.
- Throws:
QueryExecutionException
- If the expression cannot be evaluated.
toString
public String toString()
- Return a string representation of this expression.
In the form:
Expression
[ NOT ] [$]IN [ LIKE ] [ ALL ]
( Expression
[ , Expression
* ] )
- Specified by:
toString
in class Expression
- Returns:
- A string representation of this expression.
Copyright © 2008 Gary Bentley. All Rights Reserved.