/** * {@inheritDoc} */ @Override public void setParentScope(final Scriptable m) { if (m == this) { throw new IllegalArgumentException("Object can't be its own parentScope"); } super.setParentScope(m); }
/** * {@inheritDoc} */ @Override public void setParentScope(final Scriptable m) { if (m == this) { throw new IllegalArgumentException("Object can't be its own parentScope"); } super.setParentScope(m); }
/** * Configures the specified class for access via JavaScript. * @param config the configuration settings for the class to be configured * @param window the scope within which to configure the class * @throws InstantiationException if the new class cannot be instantiated * @throws IllegalAccessException if we don't have access to create the new instance * @return the created prototype */ private ScriptableObject configureClass(final ClassConfiguration config, final Scriptable window) throws InstantiationException, IllegalAccessException { final Class< ? > jsHostClass = config.getLinkedClass(); final ScriptableObject prototype = (ScriptableObject) jsHostClass.newInstance(); prototype.setParentScope(window); configureConstantsPropertiesAndFunctions(config, prototype); return prototype; }
/** * Configures the specified class for access via JavaScript. * @param config the configuration settings for the class to be configured * @param window the scope within which to configure the class * @throws InstantiationException if the new class cannot be instantiated * @throws IllegalAccessException if we don't have access to create the new instance * @return the created prototype */ private ScriptableObject configureClass(final ClassConfiguration config, final Scriptable window) throws InstantiationException, IllegalAccessException { final Class< ? > jsHostClass = config.getLinkedClass(); final ScriptableObject prototype = (ScriptableObject) jsHostClass.newInstance(); prototype.setParentScope(window); configureConstantsPropertiesAndFunctions(config, prototype); return prototype; }
/** * Configures the specified class for access via JavaScript. * @param config the configuration settings for the class to be configured * @param window the scope within which to configure the class * @throws InstantiationException if the new class cannot be instantiated * @throws IllegalAccessException if we don't have access to create the new instance * @return the created prototype */ private ScriptableObject configureClass(final ClassConfiguration config, final Scriptable window) throws InstantiationException, IllegalAccessException { final Class< ? > jsHostClass = config.getLinkedClass(); final ScriptableObject prototype = (ScriptableObject) jsHostClass.newInstance(); prototype.setParentScope(window); configureConstantsPropertiesAndFunctions(config, prototype); return prototype; }
private static void defineConstructor(final Window window, final Scriptable prototype, final ScriptableObject constructor) { constructor.setParentScope(window); try { ScriptableObject.defineProperty(prototype, "constructor", constructor,
private static void defineConstructor(final Window window, final Scriptable prototype, final ScriptableObject constructor) { constructor.setParentScope(window); try { ScriptableObject.defineProperty(prototype, "constructor", constructor,
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
console_.setParentScope(this); ((Console) console_).setPrototype(getPrototype(((SimpleScriptable) console_).getClass()));
console_.setParentScope(this); ((Console) console_).setPrototype(getPrototype(((SimpleScriptable) console_).getClass()));
newObject.setParentScope(this.getParentScope()); newObject.setPrototype(obj);