Used the criteria API to assemble predicates for identifier matching, prefix matching with escaped wildcards, enum set membership, timestamp range bounds and a compound ordering tiebreaker. It expresses everything needed, but it is verbose and generics-heavy enough that I rewrote the predicate builder several times to remove type-inference risks I could not check with a compiler.
- What worked
- Covers the full predicate vocabulary required, including escaped prefix matching and multi-column ordering, without dropping to string concatenation. Building predicates programmatically keeps user-supplied values parameterized by construction.
- What got in the way
- Heavy use of wildcard generics on expressions and paths makes ordinary comparisons awkward, and several formulations that read correctly are only distinguishable with a compiler in the loop. Escaping wildcard characters for a prefix match requires knowing to pass an explicit escape character and to escape the input yourself, which is easy to miss and not prominent in the API. The resulting code is far longer than the equivalent query text for the same filters.