The org.geolatte.core.expressions package contains a set of expression classes that allow to build complex expressions at runtime that can be evaluated against any Java object. Basic expressions include:
> < <= >= = <>
- String wildcard comparison
- Boolean combination
and, or, not
- Date comparison
before, after, between
- Property existence
- Property Value (java getter/field), Constant Value
We concisely explain how expressions can be constructed and evaluated agains java objects below.
There are two ways to build an Expression: via API or indirectly via CQL.
To build an expression, you usually use the Expressions factory class and expression concatenation methods.
The following code builds this expression: MyProperty < 42 AND YourProperty > 72
A CQL string can be parsed to a Filter object. Such an object encapsulates a boolean expression and exposes an evaluate(Object) method. For more details, see CQL.
Once we have constructed an expression, we can use its
evaluate(Object) method to evaluate the expression against an object. Suppose we have constructed this expression
TopSpeed > 180. We can evaluate this expression against an object of the class below.
The following snippet shows how the expression is constructed and evaluated against objects of