...
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: |
not range | For matching if the left hand side is not within a range of values defined as numbers: |
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 | |||||||
---|---|---|---|---|---|---|---|
| |||||||
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
|
...