Package js.lang

Examples of js.lang.NativeArray


            for (String id : object.keySet()) {
                String key = id.toString();
                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 {
View Full Code Here


    public Method[] getDeclaredMethods() {
        if (privateMethods == null) {
            privateMethods = new HashMap();

            for (String name : definition.keys()) {
                NativeArray metadata = definition.getPropertyAs(NativeArray.class, name);

                if (name.charAt(0) != '$' && 4 < metadata.length()) {
                    Method method = (Method) (Object) new JSMethod(name, (Class) (Object) this, metadata);
                    privateMethods.put(hash(method.getName(), method.getParameterTypes()), method);
                }
            }
        }
View Full Code Here

    public Field[] getDeclaredFields() throws SecurityException {
        if (privateFields == null) {
            privateFields = new HashMap();

            for (String name : definition.keys()) {
                NativeArray metadata = definition.getPropertyAs(NativeArray.class, name);

                if (name.charAt(0) != '$' && metadata.length() <= 4) {
                    Field field = (Field) (Object) new JSField(name, (Class) (Object) this, metadata);
                    privateFields.put(field.getName(), field);
                }
            }
        }
View Full Code Here

                name = "[".concat(nameJS);
            } else {
                name = "[L".concat(this.name).concat(";");
            }

            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

        /**
         * @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

     *         declaration order, of the method represented by this Method object
     * @since 1.5
     */
    public final Annotation[][] getParameterAnnotations() {
        if (parameterAnnotations == null) {
            parameterAnnotations = new NativeArray(getParameterTypes().length);

            for (String index : annotations.keys()) {
                List<Annotation> container = new ArrayList();
                NativeObject definition = annotations.getProperty(index, new NativeObject());

View Full Code Here

     *             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

     * @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

    /**
     * {@inheritDoc}
     */
    @Override
    public void clear() {
        items = new NativeArray();
    }
View Full Code Here

     * @exception NullPointerException if the specified {@code componentType} parameter is null
     * @exception IllegalArgumentException if componentType is {@link Void#TYPE}
     * @exception NegativeArraySizeException if the specified {@code length} is negative
     */
    public static Object newInstance(Class<?> componentType, int length) throws NegativeArraySizeException {
        NativeArray array = new NativeArray();
        array.setProperty("$", ((JSClass) (Object) componentType).getArrayClass().getName());

        for (int i = 0; i < length; i++) {
            if (componentType.isPrimitive()) {
                if (componentType == long.class) {
                    array.set(i, 0L);
                } else {
                    array.set(i, 0);
                }
            } else {
                array.set(i, null);
            }
        }
        return array;
    }
View Full Code Here

TOP

Related Classes of js.lang.NativeArray

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.