private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }
private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }
private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }
private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }
private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }
private Object js_construct(Scriptable scope, Object[] args) { ImporterTopLevel result = new ImporterTopLevel(); for (int i = 0; i != args.length; ++i) { Object arg = args[i]; if (arg instanceof NativeJavaClass) { result.importClass((NativeJavaClass)arg); } else if (arg instanceof NativeJavaPackage) { result.importPackage((NativeJavaPackage)arg); } else { throw Context.reportRuntimeError1( "msg.not.class.not.pkg", Context.toString(arg)); } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.setParentScope(scope); result.setPrototype(this); return result; }