How to use the java.newArray function in java

To help you get started, we’ve selected a few java examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zuazo / node-jmx / lib / adapters / javaReflection.js View on Github external
function newClassArray(params) {
      var classArray = [];
      params.forEach(function(value) {
        // TODO: this must be done async
        var javaClass = java.callStaticMethodSync("java.lang.Class", "forName", value);
        classArray.push(javaClass);
      });
      var paramsClass = java.newArray("java.lang.Class", classArray);
      return paramsClass;
    }
github zuazo / node-jmx / lib / adapters / mbeanServerConnection.js View on Github external
MBeanServerConnection.prototype.getAttributes = function(name, attributes, callback) {
  
  var xattributes = java.newArray('java.lang.String', attributes);
  
  // Note: the notation for a string array, which is a parameter to this call, is
  // as follows:  "[Ljava.lang.String;"  ... this is equivalent to a java.lang.String [] parameter
  this.javaReflection.invokeMethod(
    this.mbeanServerConnection,
    'getAttributes',
    [ "javax.management.ObjectName", "[Ljava.lang.String;" ], // methodParamsClass
    [ name, attributes ], // methodParams
    callback
  );
};
github zuazo / node-jmx / test / adapters / mbeanServerConnection.js View on Github external
it("#invoke", function(done) {
    var method = "invoke";

    var paramsArray = java.newArray("java.lang.Object", [ "params" ]);
    var signatureArray = java.newArray("java.lang.String", [ "signature" ]);

    var methodParamsClass = [ "javax.management.ObjectName", "java.lang.String", "[Ljava.lang.Object;", "[Ljava.lang.String;" ];
    var methodParams = [ "name", "operationName", [ "params" ], [ "signature" ] ];
    testReflectionCall(method, methodParamsClass, methodParams, function(obj, method2, methodParamsClass2, methodParams2, callback2) {
      var newMethodParams = [ "name", "operationName", paramsArray, signatureArray];
      assert.deepEqual(methodParamsClass, methodParamsClass2);
      assert.deepEqual(newMethodParams , methodParams2);
      done();
    });
  });
github zuazo / node-jmx / test / adapters / mbeanServerConnection.js View on Github external
it("#getAttributes", function(done) {
    var method = "getAttributes";

    var attributesArray = java.newArray("java.lang.String", [ "attribute", "attribute" ]);

    var methodParamsClass = [ "javax.management.ObjectName", "[Ljava.lang.String;" ];
    var methodParams = [ "name", [ "attribute", "attribute" ] ];
    testReflectionCall(method, methodParamsClass, methodParams, function(obj, method2, methodParamsClass2, methodParams2, callback2) {
      var newMethodParams = [ "name", attributesArray ];
      assert.deepEqual(methodParamsClass, methodParamsClass2);
      assert.deepEqual(newMethodParams, methodParams2);
      done();
    });
  });
github zuazo / node-jmx / test / adapters / mbeanServerConnection.js View on Github external
it("#invoke", function(done) {
    var method = "invoke";

    var paramsArray = java.newArray("java.lang.Object", [ "params" ]);
    var signatureArray = java.newArray("java.lang.String", [ "signature" ]);

    var methodParamsClass = [ "javax.management.ObjectName", "java.lang.String", "[Ljava.lang.Object;", "[Ljava.lang.String;" ];
    var methodParams = [ "name", "operationName", [ "params" ], [ "signature" ] ];
    testReflectionCall(method, methodParamsClass, methodParams, function(obj, method2, methodParamsClass2, methodParams2, callback2) {
      var newMethodParams = [ "name", "operationName", paramsArray, signatureArray];
      assert.deepEqual(methodParamsClass, methodParamsClass2);
      assert.deepEqual(newMethodParams , methodParams2);
      done();
    });
  });
github nawforce / ApexLink / assist / cli / src / api / org.ts View on Github external
public addPackage(namespace: string, directories: string[], basePackages: string[]): Package {
    return new Package(
      this.org.addPackageSync(
        namespace,
        java.newArray("java.lang.String", directories),
        java.newArray("java.lang.String", basePackages)
      )
    );
  }
github KRMAssociatesInc / eHMP / rdk / product / production / rdk / ccow / contextProcess.js View on Github external
function setContext(paramBlob, mContextManagerUrl, participantUrl) {
    var initializeContext = java.newInstanceSync('com.sentillion.sdkweb.webcontextor.WebContextor');
    var blob = java.newArray('java.lang.String', [null]);
    blob[0] = java.callMethodSync(initializeContext, 'getLastContextBlob');
    var contextItems = [];
    var _state = 0,
        dfn = '',
        icn = '',
        participantCoupon = '',
        contextCoupon = '',
        jsonData = {};

    if (blob[0] === '' && paramBlob !== '') {
        blob[0] = paramBlob;
    }

    if (mContextManagerUrl === undefined) {
        jsonData.statusCode = 500;
        jsonData.message = 'Cannot retrieve context manager url.';
github ngageoint / geopackage-js / geopackage-legacy.js View on Github external
toArray(tileStream, function (err, parts) {
      var byteArray = [];
      for (var k = 0; k < parts.length; k++) {
        var part = parts[k];
        for (var i = 0; i < part.length; i++) {
          var bufferPiece = part[i];
          var byte = java.newByte(bufferPiece);
          byteArray.push(byte);
        }
      }
      var bytes = java.newArray('byte', byteArray);
      newRow.setTileDataSync(bytes);
      tileDao.createSync(newRow);
      callback(null, self);
    });
  }).done();
github zuazo / node-jmx / lib / adapters / mbeanServerConnection.js View on Github external
function GetCredentials(callback) {
    var self = this;
    var credentials = java.newArray("java.lang.String", [ self.username, self.password ]);
    java.newInstance("java.util.HashMap", function(err, map) {
      if (checkError(err, self)) return;
      if (typeof self.username === "string" && typeof self.password  === "string") {
        var JMXConnector = java.import("javax.management.remote.JMXConnector");
        map.put(JMXConnector.CREDENTIALS, credentials, function(err) {
          if (checkError(err, self)) return;
          callback(map);
        });
      } else {
        callback(map);
      }
    });
  }
github DanielGarciaMandillo / angular-java / app / angularApp / tsJavaModule.js View on Github external
function newArray(className, arg) {
        var fullName = fullyQualifiedName(className) || className;
        return _java.newArray(fullName, arg);
    }
    Java.newArray = newArray;