Relates :
|
JSObject and browser JSObject linkers provide easier access to instances of jdk.nashorn.api.scripting.JSObject and netscape.javascript.JSObject. But sometimes we may need to call/access underlying Java APIs of these classes directly. For example calling "eval" on these objects. So, JSObjectLinker and BrowserJSObjectLinker classes should allow explicit method signature access to public methods of the objects. Example: var m = new javax.script.ScriptEngineManager(); var e = m.getEngineByName("nashorn"); function func(obj) { // explicit signature method access print(obj['getMember(java.lang.String)']("foo")); print(obj['eval(String)']("this + 44")); return obj; } func(e.eval("({ foo: 33, valueOf: function() 42 })"));