Java Script Engine scriptEngine(String epStr, Map per)

Here you can find the source of scriptEngine(String epStr, Map per)

Description

script Engine

License

Apache License

Declaration

public static Object scriptEngine(String epStr, Map per) throws ScriptException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Iterator;

import java.util.Map;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Main {

    public static Object scriptEngine(String epStr, Map per) throws ScriptException {
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("js");
        for (Iterator iterator = per.keySet().iterator(); iterator.hasNext();) {
            String type = (String) iterator.next();
            engine.put(type, per.get(type));
        }/* www  . j ava2s . co m*/
        return engine.eval(epStr);
    }
}

Related

  1. isJsEngineAvailable(String engineName, Logger logger)
  2. listGems(ScriptEngine jruby)
  3. listScriptEngines()
  4. registerFactoryToManager(ScriptEngineFactory factory, ScriptEngineManager scriptEngineManager)
  5. retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName)
  6. showEngineList()