camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevv <...@safe-mail.net>
Subject How to negate a Predicate?
Date Tue, 17 Feb 2009 04:01:20 GMT

Most of my uses of .when are like the first snippet below, very easy to read.

But I have a few uses of .when which need to negate the Predicate, and in
those places I'm using code like the second snippet below.  It works well,
and there are no compiler warnings, but it is NOT easy to read.  How should
I make this code easier to read?

    // take the first branch, if the regex DOES match...

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

    ========

    // take the first branch, if the regex DOES NOT match...

    choice().
      when(PredicateBuilder.
             not(Builder.
                   <MinaExchange>header("foo").
                     regex("cheese|whey")))
-- 
View this message in context: http://www.nabble.com/How-to-negate-a-Predicate--tp22049751s22882p22049751.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message