In additions to providing a database-independent WHERE clause for SQL queries, expressions support in-memory evaluation. An expressions can be evaluated with any type of objects that follow Java Beans method naming convention. Of course this includes DataObjects. The following API is used for expressions evaluation:
- public Object evaluate(Object object)
Evaluates expression with object, returning the result.
- public boolean match(Object object)
Returns true if an object "matches" expression criteria.
- public java.util.List filterObjects(java.util.List objects)
Returns a list of objects from the original list that match expression criteria.
|Limitation of In-Memory Expressions|
Current limitation of in-memory expressions is that no collections are permitted in the object property path. In case of DataObjects that means that path containing to-many relationships may not work for in-memory evaluation.
Here is an example of evaluating expression with a single object:
Another example - using expression to filter a list objects: