JAVA - Expression parsing & evaluating library

后端 未结 4 2118
再見小時候
再見小時候 2021-02-09 01:04

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.

4条回答
  •  感情败类
    2021-02-09 01:34

    Here would be a couple of workaround solutions that you could choose from, if you don't find an actual Java expression evaluation library:

    • Evaluate your expressions using XPath.
      • Pros: XPath knows logical operators, and you can implement variables and custom functions using Xalan's extensions
      • Cons: XPath has fewer types than Java
    • Evaluate your expressions using JavaScript.
      • Pros: Javascript is very flexible and will still be suitable when your requirements tighten. You can implement variables and custom functions using Javascript as well
      • Cons: Javascript has fewer types than Java
    • Evaluate your expressions using JSP's expression language (e.g. with JUEL)

提交回复
热议问题