zoukankan      html  css  js  c++  java
  • Eval 规格严格

    There is no standard Java class or method that will do what you want. Your options include:

    • Select and use some third-party expression evaluation library. For example JEL or any of the half dozen libraries listed here.

    • Wrap the expression in the Java source code for a class with an eval method, send that to the Java compiler, and then load the resulting compiled class.

    • Use some scripting language that can be called from Java as an expression evaluator. Possibilities include Javascript, BeanShell, and so on.

    • Write your own expression evaluator from scratch.

    The first approach is probably simplest. The second and third approaches are a potential security risk if you get the expression to be evaluated from an untrusted user. (Think code injection.)


    http://stackoverflow.com/questions/2605032/using-eval-in-java
    http://stackoverflow.com/questions/6559885/converting-a-string-operation-to-short-java?lq=1
    http://www.java2s.com/Code/Java/JDK-6/CompilingfromMemory.html

    http://www.crazyit.org/thread-3908-1-1.html
    http://crazyit.org/thread-1064-1-1.html
     

  • 相关阅读:
    第一个Java程序
    kibana 创建index pattern 索引模式时过慢导致无法创建成功 以及解决方案
    各种推导式
    生成器表达式
    生成器函数进阶
    迭代器和生成器
    pyhton 监听文件输入实例
    window 日志清除
    window iis重启
    TCP/IP四层模型
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/2682523.html
Copyright © 2011-2022 走看看