camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevv <...@safe-mail.net>
Subject Re: How to negate a Predicate?
Date Wed, 18 Feb 2009 01:54:49 GMT

Thanks Claus, that's a good idea.  Using "import static" makes the usage of
PredicateBuilder.not much easier to read.

When I use your code as-is, I get these warnings:


Type safety: Unchecked invocation not(Predicate) of the generic method
not(Predicate<E>) of type PredicateBuilder
> 
> Type safety: The expression of type Predicate needs unchecked conversion
> to conform to Predicate<E>

in Camel 1.5.0.  It's too late in my release cycle to upgrade to Camel 1.6.0
now.  But that's OK; I can avoid those warnings by using Builder.header
instead of BuilderSupport.header.

My code now looks like this:

    choice().
      when(not(Builder.
                 header("foo").
                   regex("cheese|whey")))

which is much easier to read than before.
-- 
View this message in context: http://www.nabble.com/How-to-negate-a-Predicate--tp22049751s22882p22070670.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message