package com.scm.platform;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Main {
public static void main(String[] args) {
String expression = "number > 0";
Number number = 10; // 假设 number 是一个字符串变量
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("JavaScript");
engine.put("number", number);
try {
boolean result = (boolean) engine.eval(expression);
if (result) {
System.out.println("number > 0");
} else {
System.out.println("number = 0");
}
} catch (ScriptException e) {
e.printStackTrace();
}
}

}