private Object createProperty(final String name) { final int len = args.length; for (int i = len - 1; i > -1; i--) { final Object obj = args[i]; if (obj instanceof StaticClass) { if (((StaticClass)obj).getRepresentedClass().getSimpleName().equals(name)) { return obj; } } else if (obj instanceof NativeJavaPackage) { final String pkgName = ((NativeJavaPackage)obj).getName(); final String fullName = pkgName.isEmpty() ? name : (pkgName + "." + name); final Context context = Global.instance().getContext(); try { return StaticClass.forClass(context.findClass(fullName)); } catch (final ClassNotFoundException e) { // IGNORE } } } return null; }
private Object createProperty(final String name) { final int len = args.length; for (int i = len - 1; i > -1; i--) { final Object obj = args[i]; if (obj instanceof StaticClass) { if (((StaticClass)obj).getRepresentedClass().getSimpleName().equals(name)) { return obj; } } else if (obj instanceof NativeJavaPackage) { final String pkgName = ((NativeJavaPackage)obj).getName(); final String fullName = pkgName.isEmpty() ? name : (pkgName + "." + name); try { return StaticClass.forClass(Class.forName(fullName)); } catch (final ClassNotFoundException e) { // IGNORE } } } return null; }
private void initJavaAccess() { final ScriptObject objectProto = getObjectPrototype(); this.builtinPackages = new NativeJavaPackage("", objectProto); this.builtinCom = new NativeJavaPackage("com", objectProto); this.builtinEdu = new NativeJavaPackage("edu", objectProto); this.builtinJava = new NativeJavaPackage("java", objectProto); this.builtinJavafx = new NativeJavaPackage("javafx", objectProto); this.builtinJavax = new NativeJavaPackage("javax", objectProto); this.builtinOrg = new NativeJavaPackage("org", objectProto); this.builtinJavaImporter = initConstructor("JavaImporter", ScriptFunction.class); this.builtinJavaApi = initConstructor("Java", ScriptObject.class); }
private void initJavaAccess() { final ScriptObject objectProto = getObjectPrototype(); this.builtinPackages = new NativeJavaPackage("", objectProto); this.builtinCom = new NativeJavaPackage("com", objectProto); this.builtinEdu = new NativeJavaPackage("edu", objectProto); this.builtinJava = new NativeJavaPackage("java", objectProto); this.builtinJavafx = new NativeJavaPackage("javafx", objectProto); this.builtinJavax = new NativeJavaPackage("javax", objectProto); this.builtinOrg = new NativeJavaPackage("org", objectProto); }
private void initJavaAccess() { final ScriptObject objectProto = getObjectPrototype(); this.builtinPackages = new NativeJavaPackage("", objectProto); this.builtinCom = new NativeJavaPackage("com", objectProto); this.builtinEdu = new NativeJavaPackage("edu", objectProto); this.builtinJava = new NativeJavaPackage("java", objectProto); this.builtinJavafx = new NativeJavaPackage("javafx", objectProto); this.builtinJavax = new NativeJavaPackage("javax", objectProto); this.builtinOrg = new NativeJavaPackage("org", objectProto); this.builtinJavaImporter = initConstructor("JavaImporter"); this.builtinJavaApi = initConstructor("Java"); }