cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej Michalec <>
Subject Re: SeachConditionBuilder for CXF JAX-RS clients
Date Sat, 05 Mar 2011 23:21:49 GMT
Finally I managed to publish draft version, it's already commited as revision
1078380 (unfortunatelly Hudson/Jenkins shows previous builds failed so I
guess the one ignited by my commit also will fail). Anyway you can find
"" package that has
SearchConditionBuilder fluent interface with FIQL implementation.
The interface is composed of subinterfaces to allow writer use only these
operations that make sense at the moment e.g. one cannot say
'is("foo").and().greaterThan(10)'. This syntax checking makes writing more
fluent for developer especially in IDE with intelli-type mechanism.

Most examples are built-in unit test, but just to make a teaser, let me
share couple examples:

FiqlSearchConditionBuilder b = new FiqlSearchConditionBuilder();
// gives "price=gt=30.0;price=lt=50.0"

for complex situation with multilateral junctions, fluent interface is a bit
broken but one can still express it like this one:

PartialCondition c = b.query();"price").lessThan(100).and().or("title").equalTo("The lord*"),"author").equalTo("R.R.Tolkien")).build();
// gives "price=lt=100.0;(title==The lord*,author==R.R.Tolkien)"

As always I am waiting for comments.

The other issue I fixed is my second commit (revision 1078381) regarding
flaw in SimpleSearchCondition. Till now it was not checked that condition
object of type T cannot have property (getter to be precise) that returns
primitive type. This is limiting but is necessary: mechanism heavily rely on
nullability of properties - null field means it is not used as criterion;
since primitive types are not nullable, this led to misbehavior of engine
(which was not detected by unit tests so far). This fix introduces check
that throws exception when detects using primitive type in property of type
T. It means that if we want to use jaxrs-annotated POJOs they are
additinally constrained (I had to change SearchContextImplTest to not use
Book class from resources having getId() returning int).


View this message in context:
Sent from the cxf-dev mailing list archive at

View raw message