Search in sources :

Example 1 with AviatorScriptEngine

use of com.googlecode.aviator.script.AviatorScriptEngine in project aviatorscript by killme2008.

the class ConfigureEngine method main.

public static void main(final String[] args) throws Exception {
    final ScriptEngineManager sem = new ScriptEngineManager();
    ScriptEngine engine = sem.getEngineByName("AviatorScript");
    AviatorEvaluatorInstance instance = ((AviatorScriptEngine) engine).getEngine();
    // Use compatible feature set
    instance.setOption(Options.FEATURE_SET, Feature.getCompatibleFeatures());
    // Doesn't support if in compatible feature set mode.
    engine.eval("if(true) { println('support if'); }");
}
Also used : AviatorEvaluatorInstance(com.googlecode.aviator.AviatorEvaluatorInstance) AviatorScriptEngine(com.googlecode.aviator.script.AviatorScriptEngine) ScriptEngineManager(javax.script.ScriptEngineManager) ScriptEngine(javax.script.ScriptEngine) AviatorScriptEngine(com.googlecode.aviator.script.AviatorScriptEngine)

Aggregations

AviatorEvaluatorInstance (com.googlecode.aviator.AviatorEvaluatorInstance)1 AviatorScriptEngine (com.googlecode.aviator.script.AviatorScriptEngine)1 ScriptEngine (javax.script.ScriptEngine)1 ScriptEngineManager (javax.script.ScriptEngineManager)1