java中jexl2处理表达式

  • Post author:
  • Post category:java


很好的一个工具,以后可能会用到,先记录下。

    public static void main(String[] args) throws ScriptException {
        String analyticLogic = "aaa>1";
        Bindings faultBindings =  new SimpleBindings();

        String signalInvolved = "aaa";
        String[] signalInvolvedSplit = signalInvolved.split(",");
        for (String s : signalInvolvedSplit) {
                    faultBindings.put(s, "7");
        }
        Object eval = ENGINE.eval(analyticLogic, faultBindings);
        System.out.println("eval = " + eval);
        String s = String.valueOf(eval);
        System.out.println("s = " + s);
    }



版权声明:本文为weixin_43555115原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。