Package org.mozilla.javascript

Examples of org.mozilla.javascript.NativeArray


                        } catch (RhinoException rex) {
                            ToolErrorReporter.reportException(
                                cx.getErrorReporter(), rex);
                        }
                    }
                    NativeArray h = global.history;
                    h.put((int)h.getLength(), h, source);
                }
            }
            ps.println();
        } else {
            processFile(cx, global, filename);
View Full Code Here


                        } catch (RhinoException rex) {
                            ToolErrorReporter.reportException(
                                cx.getErrorReporter(), rex);
                        }
                    }
                    NativeArray h = global.history;
                    h.put((int)h.getLength(), h, source);
                }
            }
            ps.println();
        } else {
            processFile(cx, global, filename);
View Full Code Here

    if ( args.length == 0 ) {
      return null;
    }
    JavaScriptResultSet resultSet = (JavaScriptResultSet) thisObj;
    if ( ( args.length == 1 ) && ( args[0] instanceof NativeArray ) ) {
      NativeArray array = (NativeArray) args[0];
      resultSet.setMetaData( JavaScriptResultSet.createMetadata( array, thisObj ) );
    } else if ( ( args.length == 2 ) && ( args[0] instanceof NativeArray ) && ( args[1] instanceof NativeArray ) ) {
      NativeArray array = (NativeArray) args[0];
      MemoryMetaData metaData = JavaScriptResultSet.createMetadata( array, thisObj );
      // create some metadata objects
      array = (NativeArray) args[1];
      int length = (int) array.getLength();
      String[] columnTypes = new String[length];
      for ( int i = 0; i < length; i++ ) {
        columnTypes[i] = array.get( i, thisObj ).toString();
      }
      metaData.setColumnTypes( columnTypes );
      resultSet.setMetaData( metaData );
    } else {
      int length = args.length;
View Full Code Here

      return null;
    }
    // TODO support dates
    JavaScriptResultSet resultSet = (JavaScriptResultSet) thisObj;
    if ( ( args.length == 1 ) && ( args[0] instanceof NativeArray ) ) {
      NativeArray array = (NativeArray) args[0];
      int length = (int) array.getLength();
      Object[] row = new Object[length];
      String[] columnTypes = ( (MemoryMetaData) resultSet.getMetaData() ).getColumnTypes();
      for ( int i = 0; i < length; i++ ) {
        Object data = array.get( i, thisObj );
        if ( data == null ) {
          row[i] = null;
        } else if ( columnTypes != null ) {
          if ( data instanceof NativeJavaObject ) {
            // see if we can force a conversion
View Full Code Here

    public void remove(int i) {
        _list.remove(i);
    }
   
    public NativeArray toArray() {
        return new NativeArray(_list.toArray());
    }
View Full Code Here

            cl.clear();
            cl.addAll(java.util.Arrays.asList(values));
        } else if (property instanceof NativeArray) {
            Context.enter();
            try {
                NativeArray arr = (NativeArray) property;

                ScriptableObject.putProperty(arr, "length", new Integer(0));
                ScriptableObject.putProperty(arr, "length",
                                             new Integer(values.length));
                for (int i = 0; i<values.length; i++) {
View Full Code Here

        }
        Object result = jxcontext_.getValue(xpath);

        if (result instanceof NativeArray) {
            // Convert JavaScript array to Collection
            NativeArray arr = (NativeArray) result;
            int len = (int) arr.jsGet_length();
            List list = new ArrayList(len);

            for (int i = 0; i<len; i++) {
                Object obj = arr.get(i, arr);

                if (obj==Context.getUndefinedValue()) {
                    obj = null;
                }
                list.add(obj);
View Full Code Here

            cl.clear();
            cl.addAll(java.util.Arrays.asList(values));
        } else if (property instanceof NativeArray) {
            Context.enter();
            try {
                NativeArray arr = (NativeArray) property;

                ScriptableObject.putProperty(arr, "length", new Integer(0));
                ScriptableObject.putProperty(arr, "length",
                                             new Integer(values.length));
                for (int i = 0; i<values.length; i++) {
View Full Code Here

        }
        Object result = jxcontext_.getValue(xpath);

        if (result instanceof NativeArray) {
            // Convert JavaScript array to Collection
            NativeArray arr = (NativeArray) result;
            int len = (int) arr.jsGet_length();
            List list = new ArrayList(len);

            for (int i = 0; i<len; i++) {
                Object obj = arr.get(i, arr);

                if (obj==Context.getUndefinedValue()) {
                    obj = null;
                }
                list.add(obj);
View Full Code Here

            cl.clear();
            cl.addAll(java.util.Arrays.asList(values));
        } else if (property instanceof NativeArray) {
            Context.enter();
            try {
                NativeArray arr = (NativeArray) property;

                ScriptableObject.putProperty(arr, "length", new Integer(0));
                ScriptableObject.putProperty(arr, "length",
                                             new Integer(values.length));
                for (int i = 0; i<values.length; i++) {
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.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.