All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mvel2.jsr223.MvelCompiledScript Maven / Gradle / Ivy

Go to download

TBEL is a powerful expression language for ThingsBoard platform user-defined functions. Original implementation is based on MVEL.

There is a newer version: 1.2.4
Show newest version
package org.mvel2.jsr223;

import java.io.Serializable;

import javax.script.CompiledScript;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptException;

public class MvelCompiledScript extends CompiledScript {

    private final MvelScriptEngine scriptEngine;
    private final Serializable     compiledScript;

    public MvelCompiledScript(MvelScriptEngine engine, Serializable compiledScript) {
        this.scriptEngine = engine;
        this.compiledScript = compiledScript;
    }

    @Override
    public Object eval(ScriptContext context) throws ScriptException {
        return scriptEngine.evaluate(compiledScript, context);
    }

    @Override
    public ScriptEngine getEngine() {
        return scriptEngine;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy