Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Operator

Description

==

equals

>

greather than

>=

greather than or equals

<

less than

<=

less than or equals

!=

not equals

contains

For testing if contains in a string based value

not contains

For testinf if not contains in a string based value

regex

For matching against a given regular expression pattern defined as a String value

not regex

For not matching against a given regular expression pattern defined as a String value

in

For matching if in a set of values, each element must be separated by comma.

not in

For matching if not in a set of values, each element must be separated by comma.

is

For matching if the left hand side type is an instanceof the value.

not is

For matching if the left hand side type is not an instanceof the value.

range

For matching if the left hand side is within a range of values defined as numbers: from..to

not range

For matching if the left hand side is not within a range of values defined as numbers: from..to

Some examples:

Code Block
simple("${in.header.foo} == 'foo'")

// ' ' can be omitted
simple("${in.header.foo} == foo")

// here Camel will type convert '100' into the type of in.header.bar and if its an Integer '100' will also be converter to an Integer
simple("${in.header.bar} == '100'")

simple("${in.header.bar} == 100")

// 100 will be converter to the type of in.header.bar so we can do > comparison
simple("${in.header.bar} > 100")

// testing for null
simple("${in.header.baz} == null")

// testing for not null
simple("${in.header.baz} != null")

...

Code Block
simple("${in.header.type} not in 'gold,silver'")

And you can test for if the type is a certain instance, eg for instance a String

Code Block

simple("${in.header.type} is 'java.lang.String'")

We have added a shorthand for all java.lang types so you can write it as:

Code Block

simple("${in.header.type} is String")

Ranges is also supported. The range interval requires numbers and both from and end is inclusive. For instance to test whether a value is between 100 and 199:

Code Block

simple("${in.header.number} range 100..199")

Notice we use .. in the range without spaces. Its based on the same syntax as Groovy.

Tip
titleCan be used in Spring XML

As the Spring XML does not have all the power as the Java DSL with all its various builder methods, you had to resort to use some other languages
for testing with simple operators. Now you can do this with the simple language. In the sample below we want to test if the header is a widget order:

Code Block
xml
xml
    <from uri="seda:orders">
       <filter>
           <simple>${in.header.type} == 'widget'</simple>
           <to uri="bean:orderService?method=handleWidget"/>
       </filter>
    </from>

...