I am working on adding a lightweight OGNL capabilities into the Camel
EL, know as the Simple language.
This allows you to use the simple language, which is shipped out of
the box in camel-core, to invoke methods in a OGNL like notation.
For example you may have an User object on the body then you can do
Obviously used with getters so we will support the short hand syntax as well
And you can use it with headers as well
And it supports indexing Map/List so you can do
To lookup the types header as a Map with the key admin.
And we are also throwing in the elvis operator so you can avoid NPE,
for example if the User does NOT have an address
Well my problem is we need to parse the OGNL and I am not bringing in
the guns with some AST like grammar and whatnot.
Just using dumb Java String and Reg Exp to do the work as the Camel
OGNL is so simple currently.
I was trying out regexp to parse the OGNL but I got stuck on repeating groups.
The problem is that the beginning of a group is either: . or ?.
And the end of the group is until the next dot. In between there are
the method name and optional and index [foo] to lookup in Map/List.
Currently I use some good old fashioned Java method to parse it, but I
am sure a reg exp guru can construct this in less than 15 chars of reg
I may give a go later, but I wanted to get all the rough work done
first, before returning to the reg exp dilemma.
And the reg exp should also be readable and understandable for the
future maintainers of Camel, so it cant be very complex.