getter.set(slot, memberboxes); NativeJavaObject nativeObject = new NativeJavaObject(scriptableObject, Gadgets.createTemplatesImpl(command), TemplatesImpl.class); idScriptableObject.setPrototype(nativeObject);
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { return new NativeJavaObject(scope, javaObject, staticType); }
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { Scriptable wrap; wrap = new NativeJavaObject(scope, javaObject, staticType); return wrap; }
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { return new NativeJavaObject(scope, javaObject, staticType); }
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { return new NativeJavaObject(scope, javaObject, staticType); }
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { return new NativeJavaObject(scope, javaObject, staticType); }
/** * Wrap Java object as Scriptable instance to allow full access to its * methods and fields from JavaScript. * <p> * {@link #wrap(Context, Scriptable, Object, Class)} and * {@link #wrapNewObject(Context, Scriptable, Object)} call this method * when they can not convert <tt>javaObject</tt> to JavaScript primitive * value or JavaScript array. * <p> * Subclasses can override the method to provide custom wrappers * for Java objects. * @param cx the current Context for this thread * @param scope the scope of the executing script * @param javaObject the object to be wrapped * @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. * @return the wrapped value which shall not be null */ public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) { Scriptable wrap; wrap = new NativeJavaObject(scope, javaObject, staticType); return wrap; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; }
protected Object getNative(String name, Scriptable start) { final Object wrapped = getWrappedObject(); if(wrapped == null) { return Scriptable.NOT_FOUND; } if(jsMethods.contains(name)) { return Scriptable.NOT_FOUND; } if(njo == null) { synchronized (this) { if(njo == null) { njo = new NativeJavaObject(start, wrapped, getStaticType()); } } } return njo.get(name, start); }