Java Code Examples for jdk.nashorn.api.scripting.ScriptObjectMirror#wrap()
The following examples show how to use
jdk.nashorn.api.scripting.ScriptObjectMirror#wrap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSObjectLinker.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object jsObjectScopeCall(final JSObject jsObj, final Object thiz, final Object[] args) { final Object modifiedThiz; if (thiz == ScriptRuntime.UNDEFINED && !jsObj.isStrictFunction()) { final Global global = Context.getGlobal(); modifiedThiz = ScriptObjectMirror.wrap(global, global); } else { modifiedThiz = thiz; } return jsObj.call(modifiedThiz, args); }
Example 2
Source File: ListAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 3
Source File: ListAdapter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 4
Source File: JSObjectLinker.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object jsObjectScopeCall(final JSObject jsObj, final Object thiz, final Object[] args) { final Object modifiedThiz; if (thiz == ScriptRuntime.UNDEFINED && !jsObj.isStrictFunction()) { final Global global = Context.getGlobal(); modifiedThiz = ScriptObjectMirror.wrap(global, global); } else { modifiedThiz = thiz; } return jsObj.call(modifiedThiz, args); }
Example 5
Source File: ListAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 6
Source File: JSObjectLinker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object jsObjectScopeCall(final JSObject jsObj, final Object thiz, final Object[] args) { final Object modifiedThiz; if (thiz == ScriptRuntime.UNDEFINED && !jsObj.isStrictFunction()) { final Global global = Context.getGlobal(); modifiedThiz = ScriptObjectMirror.wrap(global, global); } else { modifiedThiz = thiz; } return jsObj.call(modifiedThiz, args); }
Example 7
Source File: ListAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 8
Source File: JSObjectLinker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object jsObjectScopeCall(final JSObject jsObj, final Object thiz, final Object[] args) { final Object modifiedThiz; if (thiz == ScriptRuntime.UNDEFINED && !jsObj.isStrictFunction()) { final Global global = Context.getGlobal(); modifiedThiz = ScriptObjectMirror.wrap(global, global); } else { modifiedThiz = thiz; } return jsObj.call(modifiedThiz, args); }
Example 9
Source File: ListAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 10
Source File: ListAdapter.java From hottub with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }
Example 11
Source File: ListAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Factory to create a ListAdapter for a given script object. * * @param obj script object to wrap as a ListAdapter * @return A ListAdapter wrapper object */ public static ListAdapter create(final Object obj) { if (obj instanceof ScriptObject) { final Object mirror = ScriptObjectMirror.wrap(obj, Context.getGlobal()); return new JSObjectListAdapter((JSObject)mirror); } else if (obj instanceof JSObject) { return new JSObjectListAdapter((JSObject)obj); } else { throw new IllegalArgumentException("ScriptObject or JSObject expected"); } }
Example 12
Source File: ListAdapter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Factory to create a ListAdapter for a given script object. * * @param obj script object to wrap as a ListAdapter * @return A ListAdapter wrapper object */ public static ListAdapter create(final Object obj) { if (obj instanceof ScriptObject) { final Object mirror = ScriptObjectMirror.wrap(obj, Context.getGlobal()); return new JSObjectListAdapter((JSObject)mirror); } else if (obj instanceof JSObject) { return new JSObjectListAdapter((JSObject)obj); } else { throw new IllegalArgumentException("ScriptObject or JSObject expected"); } }
Example 13
Source File: JSObjectLinker.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") private static Object jsObjectScopeCall(final JSObject jsObj, final Object thiz, final Object[] args) { final Object modifiedThiz; if (thiz == ScriptRuntime.UNDEFINED && !jsObj.isStrictFunction()) { final Global global = Context.getGlobal(); modifiedThiz = ScriptObjectMirror.wrap(global, global); } else { modifiedThiz = thiz; } return jsObj.call(modifiedThiz, args); }
Example 14
Source File: ListAdapter.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private static JSObject getJSObject(final Object obj, final Global global) { if (obj instanceof ScriptObject) { return (JSObject)ScriptObjectMirror.wrap(obj, global); } else if (obj instanceof JSObject) { return (JSObject)obj; } throw new IllegalArgumentException("ScriptObject or JSObject expected"); }