@Test public void testExecScript () throws ScriptLoadException { JSRhinoScriptEngine engine = new JSRhinoScriptEngine(); engine.compile("test", "java.lang.System.out.println(\"test\");"); Object obj = engine.execScript("test", null); assertNull(obj); }
@Override public Object execScript(String scriptName, Object... args) { Script script = this.scripts.get(scriptName); if (script == null) { throw new IllegalStateException("js script '" + scriptName + "' doesn't exists in cache, you have to compile it first!"); } if (args != null && args.length > 0) { throw new UnsupportedOperationException("javascript doesn't supports args for scripts."); } Log.d(SCRIPTS_TAG, "execute js script '" + scriptName + "'"); script.exec(this.cx, this.scope); return null; }
JSRhinoScriptEngine implements IScriptEngine { @Override public Object execScript(String scriptName, Object... args) { Script script = this.scripts.get(scriptName); if (script == null) { throw new IllegalStateException("js script '" + scriptName + "' doesn't exists in cache, you have to compile it first!"); } if (args != null && args.length > 0) { throw new UnsupportedOperationException("javascript doesn't supports args for scripts."); } Log.d(SCRIPTS_TAG, "execute js script '" + scriptName + "'"); script.exec(this.cx, this.scope); return null; } }
JSRhinoScriptEngine implements IScriptEngine { @Override public Object execScript(String scriptName, Object... args) { Script script = this.scripts.get(scriptName); if (script == null) { throw new IllegalStateException("js script '" + scriptName + "' doesn't exists in cache, you have to compile it first!"); } if (args != null && args.length > 0) { throw new UnsupportedOperationException("javascript doesn't supports args for scripts."); } Log.d(SCRIPTS_TAG, "execute js script '" + scriptName + "'"); script.exec(this.cx, this.scope); return null; } JSRhinoScriptEngine(); }
JSRhinoScriptEngine implements IScriptEngine { @Override public Object execScript(String scriptName, Object... args) { Script script = this.scripts.get(scriptName); if (script == null) { throw new IllegalStateException("js script '" + scriptName + "' doesn't exists in cache, you have to compile it first!"); } if (args != null && args.length > 0) { throw new UnsupportedOperationException("javascript doesn't supports args for scripts."); } Log.d(SCRIPTS_TAG, "execute js script '" + scriptName + "'"); script.exec(this.cx, this.scope); return null; } JSRhinoScriptEngine(); @Override void compile(String scriptName, String programStr); @Override void loadFile(File file); @Override Object execFunc(String funcName, Object... args); @Override Object execFunc(String funcName); @Override Object execScript(String scriptName, Object... args); @Override void shutdown(); }
JSRhinoScriptEngine implements IScriptEngine { @Override public Object execScript(String scriptName, Object... args) { Script script = this.scripts.get(scriptName); if (script == null) { throw new IllegalStateException("js script '" + scriptName + "' doesn't exists in cache, you have to compile it first!"); } if (args != null && args.length > 0) { throw new UnsupportedOperationException("javascript doesn't supports args for scripts."); } Log.d(SCRIPTS_TAG, "execute js script '" + scriptName + "'"); script.exec(this.cx, this.scope); return null; } JSRhinoScriptEngine(); @Override void compile(String scriptName, String programStr); @Override void loadFile(File file); @Override Object execFunc(String funcName, Object... args); @Override Object execFunc(String funcName); @Override Object execScript(String scriptName, Object... args); @Override void shutdown();  }