The filter expression is a String containing a boolean expression evaluated for each instance of the candidate class. If the filter is not specified, it defaults to true. Rules for constructing valid expressions follow the Java language, with the following differences:
Equality and ordering comparisons between primitives and instances of wrapper classes are valid.
Equality and ordering comparisons of Date fields and Date parameters are valid.
Equality and ordering comparisons of String fields and String parameters are valid.
White space (non-printing characters space, tab, carriage return, and line feed) is a separator and is otherwise ignored.
The following assignment operators are not supported:
=, +=, etc.
pre- and post-increment
pre- and post-decrement
Methods, including object construction, are not supported, except for:
Collection.contains(Object o) Collection.isEmpty() String.startsWith(String s) String.endsWith(String e)
In addition, the Application Server supports the following nonstandard JDOQL methods:
String.like(String pattern) String.like(String pattern, char escape) String.substring(int start, int length) String.indexOf(String str) String.indexOf(String str, int start) String.length() Math.abs(numeric n) Math.sqrt(double d)
Navigation through a null-valued field, which throws a NullPointerException, is treated as if the sub-expression returned false.
Comparisons between floating point values are by nature inexact. Therefore, equality comparisons (== and !=) with floating point values should be used with caution. Identifiers in the expression are considered to be in the name space of the candidate class, with the addition of declared parameters and variables. As in the Java language, this is a reserved word, and refers to the current instance being evaluated.
The following expressions are supported:
Operators applied to all types where they are defined in the Java language:
relational operators (==, !=, >, <, >=, <=)
boolean operators (&, &&, |, ||, ~, !)
arithmetic operators (+, -, *, /)
String concatenation is supported only for String + String.
Parentheses to explicitly mark operator precedence
Cast operator
Promotion of numeric operands for comparisons and arithmetic operations. The rules for promotion follow the Java rules (see the numeric promotions of the Java language specification) extended by BigDecimal, BigInteger, and numeric wrapper classes.