Package js.lang

Examples of js.lang.NativeObject


     * @return
     */
    @JavascriptNativeProperty
    public NativeObject parse(String text) {
        try {
            return parse(new NativeObject(), script.eval("a=" + text));
        } catch (ScriptException e) {
            // If this exception will be thrown, it is bug of this program. So we must rethrow the
            // wrapped error in here.
            throw new Error(e);
        }
View Full Code Here


                Object value = object.get(id);

                if (value instanceof List) {
                    java.setProperty(key, parse(new NativeArray(), value));
                } else if (value instanceof Map) {
                    java.setProperty(key, parse(new NativeObject(), value));
                } else if (value instanceof Double) {
                    java.setProperty(key, new NativeNumber((double) value));
                } else {
                    java.setProperty(key, value.toString());
                }
View Full Code Here

     */
    Map<String, Enum> enumConstantDirectory() {
        if (enumerationConstants == null) {
            enumerationConstants = new HashMap();

            NativeObject definition = prototype.getPropertyAs(NativeObject.class, "$");

            for (String name : definition.keys()) {
                NativeObject value = definition.getPropertyAs(NativeObject.class, name);

                if (value.isArray()) {
                    for (Enum item : (Enum[]) (Object) value) {
                        enumerationConstants.put(item.name(), item);
                    }
                }
            }
View Full Code Here

            }

            NativeArray metadata = new NativeArray();
            metadata.set(1, name);

            arrayClass = new JSClass("[".concat(nameJS), new NativeObject(), metadata, Object.class, new NativeObject());
        }
        return arrayClass;
    }
View Full Code Here

            // convert java class name to javascript class name
            fqcn = boot.getPropertyAs(NativeObject.class, "names").getPropertyAs(String.class, fqcn);
        }

        NativeObject definition = boot.getPropertyAs(NativeObject.class, fqcn);

        if (definition == null) {
            throw (RuntimeException) (Object) new ClassNotFoundException(fqcn);
            // return (Class) (Object) new JSClass(fqcn, new NativeObject(), new NativeArray(),
            // Object.class, new NativeObject());
        }

        JSClass clazz = (JSClass) definition.getProperty("$");

        for (int i = 0; i < size; i++) {
            clazz = clazz.getArrayClass();
        }
        return (Class) (Object) clazz;
View Full Code Here

                    // default method
                    return method.invoke(proxy, args);
                } else {
                    // method
                    Object currentContext = context;
                    NativeObject currentHolder = lambdaMethodHolder;

                    if (currentHolder == null) {
                        currentContext = ((NativeArray) (Object) args).shift();
                        currentHolder = (NativeObject) currentContext;
                    }

                    return currentHolder.getPropertyAs(NativeFunction.class, lambdaMethodName)
                            .apply(currentContext, ((NativeArray) (Object) parameters).concat(args).toArray());
                }
            }
        });
    }
View Full Code Here

        /**
         * @param id A proxy id.
         * @param interfaces A interface list.
         */
        private ProxyClass(int id, Class[] interfaces) {
            super("Proxy" + id, new NativeObject(), new NativeArray(), ProxyBase.class, new NativeObject());

            interfacesType = Arrays.asList(interfaces);
        }
View Full Code Here

     */
    protected JSAnnotatedElement(String name, String nameJS, NativeArray<?> metadata, int indexForAnnotation) {
        this.name = name;
        this.nameJS = nameJS;
        this.metadata = metadata;
        this.annotations = metadata.get(indexForAnnotation, new NativeObject());
        this.modifiers = metadata.getAsInt(0, 0);
    }
View Full Code Here

        if (!declared.isAnnotation()) {
            return null;
        }

        NativeObject prototype = ((JSClass) (Object) declared).prototype;

        if (prototype.getProperty(nameJS) == null) {
            return null;
        }

        Class type = getReturnType();
        Object value = invoke(prototype);
View Full Code Here

     * @param indexForAnnotation
     */
    public Parameterizable(String name, String nameJS, Class owner, NativeArray<?> metadata, int indexForAnnotation) {
        super(name, nameJS, owner, metadata, indexForAnnotation);

        annotations = metadata.get(indexForAnnotation + 1, new NativeObject());
    }
View Full Code Here

TOP

Related Classes of js.lang.NativeObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.