Convert String to Code

前端 未结 18 970
轮回少年
轮回少年 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:58

    You shouldn't. Really!

    Are you inventing another enterprise rules engine?. You might want to read these links.

    Consider the fact that the only people that is skilled enough to write code and then insert it into a database, probably are having an editor and a compiler anyway...

    The compiler will catch all those pesky syntax errors and you can even test the code! Remember that editors and compilers, and even computer languages were invented to help the programmer to comfortably write comprehensible code with a reasonable effort.

    While I'm at it: read about the complicators gloves too!

提交回复
热议问题