Developer guide
Importer le moteur Trevas
<dependency>
<groupId>fr.insee.trevas</groupId>
<artifactId>vtl-engine</artifactId>
<version>1.7.0</version>
</dependency>
Instancier le moteur Trevas
// Start engine
ScriptEngine engine = new ScriptEngineManager().getEngineByName("vtl");
// Add input bindings to engine
Bindings bindings = new SimpleBindings();
bindings.put("a", 1);
engine.setBindings(b, ScriptContext.ENGINE_SCOPE);
// Execute script
try {
engine.eval("b := a + 1;");
} catch (VtlScriptException e) {
logger.warn("Eval failed: ", e);
}
// Get result
Long result = (Long) engine.getBindings(ScriptContext.ENGINE_SCOPE).get("b");