Examples of NativeFunction


Examples of js.lang.NativeFunction

            for (Method method : interfaceType.getMethods()) {
                if (!method.isDefault() && (method.getDeclaringClass() != Annotation.class || method.getName()
                        .equals("annotationType"))) {
                    ProxyFunction function = new ProxyFunction(proxy, method);
                    NativeObject.by(proxy)
                            .setProperty(((JSMethod) (Object) method).nameJS, new NativeFunction(function).bind(function));
                }
            }
        }

        // API definition
View Full Code Here

Examples of js.lang.NativeFunction

         * {@inheritDoc}
         */
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            // from user value
            NativeFunction function = object.getPropertyAs(NativeFunction.class, ((JSMethod) (Object) method).nameJS);

            if (function != null) {
                Object value = function.apply(null);
                Class type = method.getReturnType();

                if (type.isAnnotation()) {
                    return Proxy.newProxyInstance(null, new Class[] {type}, new AnnotationProxy(type, value));
                } else if (type.isArray() && type.getComponentType().isAnnotation()) {
View Full Code Here

Examples of js.lang.NativeFunction

     *             comparable</i> using the specified comparator
     * @throws IllegalArgumentException (optional) if the comparator is found to violate the
     *             {@link Comparator} contract
     */
    public static <T> void sort(T[] array, Comparator<? super T> comparator) {
        new NativeArray(array).sort(new NativeFunction(comparator).bind(comparator));
    }
View Full Code Here

Examples of js.lang.NativeFunction

     * @throws IllegalArgumentException if {@code fromIndex > toIndex} or (optional) if the
     *             comparator is found to violate the {@link Comparator} contract
     * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or {@code toIndex > a.length}
     */
    public static <T> void sort(T[] array, int fromIndex, int toIndex, Comparator<? super T> comparator) {
        new NativeArray(array).sort(new NativeFunction(comparator).bind(comparator)); // FIXME
    }
View Full Code Here

Examples of js.lang.NativeFunction

                if (!annotations.isEmpty()) {
                    InterceptorFunction function = new InterceptorFunction(method.getName(), MethodHandles
                            .lookup()
                            .unreflect(method), annotations.toArray(new Annotation[annotations.size()]));
                    prototype.setProperty(Reflections.getPropertyName(method), new NativeFunction(function));
                }
            }
        } catch (Exception e) {
            throw I.quiet(e);
        }
View Full Code Here

Examples of js.lang.NativeFunction

                                try {
                                    name = Reflections.getPropertyName(model.type.getMethod(name, property.model.type));

                                    BindingFunction function = new BindingFunction(prototype.getPropertyAs(NativeFunction.class, name), property.name);
                                    prototype.setProperty(name, new NativeFunction(function));
                                } catch (Exception e) {
                                    throw I.quiet(e);
                                }
                            }
                        }
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.NativeFunction

            cx.evaluateString(scope, "var ProxyConfig = function() {}; ProxyConfig.bindings = {}", "<init>", 1, null);
            cx.evaluateString(scope, content, "<Proxy Auto-Config>", 1, null);
            final Object functionArgs[] = {url.toExternalForm(), url.getHost()};
            final Object fObj = scope.get("FindProxyForURL", scope);

            final NativeFunction f = (NativeFunction) fObj;
            final Object result = f.call(cx, scope, scope, functionArgs);
            return Context.toString(result);
        }
        finally {
            Context.exit();
        }
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.NativeFunction

                                return "__defineGetter__ " + s;
                            }
                        }
                        final Object o = obj.get(s, obj);
                        if (o instanceof NativeFunction) {
                            final NativeFunction f = (NativeFunction) o;
                            if (f.getDebuggableView() == this.functionOrScript_) {
                                return s;
                            }
                        }
                    }
                }
View Full Code Here

Examples of org.mozilla.javascript.NativeFunction

                            {
                                contextFactory.enterContext(context);

                                try
                                {
                                    NativeFunction function = (NativeFunction) scope.get(functionName, scope);

                                    return (ScriptableObject) function.call(context, scope, null, arguments);
                                } finally
                                {
                                    Context.exit();
                                }
                            }
View Full Code Here

Examples of org.mozilla.javascript.NativeFunction

                            {
                                contextFactory.enterContext(context);

                                try
                                {
                                    NativeFunction function = (NativeFunction) scope.get(functionName, scope);

                                    return (ScriptableObject) function.call(context, scope, null, arguments);
                                } finally
                                {
                                    Context.exit();
                                }
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.