Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA - Expression parsing & evaluating library

I'm looking for a JAVA library to parse & evaluate expression. I searched and tried some libraries like Apache's JEXL and Jeval, but they are not exactly what I need.

My requirements:

  1. Support all value types (i.e. int,double,boolean,String, etc.)
  2. Support all known mathematical & logical operators (+,-,*,<,<=,etc.)
  3. Support variables (without any special notation - for example in Jeval variable a should be written like #{a} - not good enough for me)
  4. Support custom functions - with type enforcement and validation

Any recommendations?

like image 405
duduamar Avatar asked Aug 14 '12 07:08

duduamar


1 Answers

Try Janino. It's a runtime in-memory compiler that can be used as an expression evaluator. Maybe it is the right thing for you.

like image 167
lost Avatar answered Oct 19 '22 08:10

lost