setFilter(filter) - JDO Query's method
The filter specification is a
String containing a Boolean expression that is to be evaluated for each of the instances in the candidate collection. If the filter is not specified, then it defaults to "true", which has the effect of filtering the input
Collection only for class type.
An element of the candidate collection is returned in the result if:
- it is assignment compatible to the candidate
- for all variables there exists a value for which the filter expression evaluates to
The user may denote uniqueness in the filter expression by explicitly declaring an expression (for example,
e1 != e2).
Rules for constructing valid expressions follow the Java language, except for these differences:
- Equality and ordering comparisons between primitives and instances of wrapper classes are valid.
- Equality and ordering comparisons of
Dateparameters are valid.
- White space (non-printing characters space, tab, carriage return, and line feed) is a separator and is otherwise ignored.
- The assignment operators
+=, etc. and pre- and post-increment and -decrement are not supported. Therefore, there are no side effects from evaluation of any expressions.
- Methods, including object construction, are not supported, except for
String.startsWith(String s), and
String.endsWith(String e). Implementations might choose to support non-mutating method calls as non-standard extensions.
- Navigation through a
null-valued field, which would throw
NullPointerException, is treated as if the filter expression returned
falsefor the evaluation of the current set of variable values. Other values for variables might still qualify the candidate instance for inclusion in the result set.
- Navigation through multi-valued fields (
Collectiontypes) is specified using a variable declaration and the
Identifiers in the expression are considered to be in the name space of the specified class, with the addition of declared imports, parameters and variables. As in the Java language,
this is a reserved word which means the element of the collection being evaluated.
Navigation through single-valued fields is specified by the Java language syntax of
A JDO implementation is allowed to reorder the filter expression for optimization purposes.
filter- the query filter.
- JDO 1.0