Nodejs Object to Java Convert toJava()

Here you can find the source of toJava()

Method Source Code

Object.prototype.toJava = function() {
  var m = JSON.json();
  for (var k in this)
    if (this.hasOwnProperty(k))
      m.set(k, this[k] == null ? null : this[k].toJava());
  return m;/*  w  w w  .  j a v  a2 s.  c  om*/
};
Array.prototype.toJava = function() {
  var l = this.length;
  var a = new java.util.ArrayList();
  for (var i = 0;i < l;i++)
    a.add(this[i].toJava());
  return a;
};
String.prototype.toJava = function() {
  return new java.lang.String(this);
};
Boolean.prototype.toJava = function() {
  return java.lang.Boolean.valueOf(this);
};
Number.prototype.toJava = function() {
  return java.lang.Integer(this);
};

Related

  1. toJava()
    Object.prototype.toJava = function() {
      var m = new org.juzu.impl.utils.JSON();
      for (var k in this)
        if (this.hasOwnProperty(k))
          m.set(k, this[k] == null ? null : this[k].toJava());
      return m;
    };
    Array.prototype.toJava = function() {
      var l = this.length;
    ...
    
  2. toJson()
    Object.defineProperty(Object.prototype, 'toJson', {
      value: function toJson() {
        return JSON.stringify(this);
      },
      enumerable: false
    });