JavaScriptParser.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:AutoLoadCache 作者:
@SuppressWarnings("unchecked")
@Override
public <T> T getElValue(String exp, Object target, Object[] arguments, Object retVal, boolean hasRetVal, Class<T> valueType) throws Exception {
    Bindings bindings=new SimpleBindings();
    bindings.put(TARGET, target);
    bindings.put(ARGS, arguments);
    if(hasRetVal) {
        bindings.put(RET_VAL, retVal);
    }
    CompiledScript script=expCache.get(exp);
    if(null != script) {
        return (T)script.eval(bindings);
    }
    if(engine instanceof Compilable) {
        Compilable compEngine=(Compilable)engine;
        script=compEngine.compile(funcs + exp);
        expCache.put(exp, script);
        return (T)script.eval(bindings);
    } else {
        return (T)engine.eval(funcs + exp, bindings);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号