public Object evaluate(final String expression, final Map<String, ?> values) throws ExpressionEvaluationException {
LOG.debug("Evaluating JavaScript expression: {1}", expression);
try {
final Bindings scope = engine.createBindings();
for (final Entry<String, ?> entry : values.entrySet()) {
scope.put(entry.getKey(), entry.getValue());
}
if (compilable != null) {
CompiledScript compiled = compiledCache.get(expression);
if (compiled == null) {
compiled = compilable.compile(expression);
compiledCache.put(expression, compiled);
}
return compiled.eval(scope);
}
return engine.eval(expression, scope);
} catch (final ScriptException ex) {
throw new ExpressionEvaluationException("Evaluating JavaScript expression failed: " + expression, ex);
}
}
ExpressionLanguageScriptEngineImpl.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:oval
作者:
评论列表
文章目录