Convert String to Code

前端 未结 18 1069
轮回少年
轮回少年 2020-11-22 09:27

I want to know if there is any way to convert a String to Java compilable code.

I have a comparative expression saved in a database field. I want to re

18条回答
  •  感动是毒
    2020-11-22 09:54

    If all you really need to do is evaluate an expression stored in a database, you might want to look at JEP (Java Expression Parser)

    The latest (commercial) version is here.

    A slightly older, GPL version is here

    Some examples for usage.

提交回复
热议问题