mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add script support
This commit is contained in:
@@ -23,7 +23,15 @@ public class JexlEngine implements ExpressionEngine {
|
||||
|
||||
@Override
|
||||
public Object eval(String expression, Map<String, Object> context) {
|
||||
return engine.createExpression(expression).evaluate(new MapContext(context));
|
||||
final MapContext mapContext = new MapContext(context);
|
||||
|
||||
try{
|
||||
return engine.createExpression(expression).evaluate(mapContext);
|
||||
} catch (Exception ignore){
|
||||
// https://gitee.com/dromara/hutool/issues/I4B70D
|
||||
// 支持脚本
|
||||
return engine.createScript(expression).execute(mapContext);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user