fix handling of java-arrays
This commit is contained in:
parent
0d5b001230
commit
bc14a31133
@ -1,3 +1,4 @@
|
|||||||
|
importClass(java.util.Arrays);
|
||||||
importClass(java.util.ArrayList);
|
importClass(java.util.ArrayList);
|
||||||
importClass(java.util.HashMap);
|
importClass(java.util.HashMap);
|
||||||
|
|
||||||
@ -51,21 +52,31 @@ function hsaParseParamObject(o) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hsaToNativeJSObject(val) {
|
function hsaToNativeJSObject(val) {
|
||||||
if (val instanceof java.util.List) {
|
if (val instanceof java.lang.Object) {
|
||||||
var res = [];
|
if (val instanceof java.util.List) {
|
||||||
for (var i = 0; i < val.size(); i++) {
|
var res = [];
|
||||||
res[i] = hsaToNativeJSObject(val.get(i));
|
for (var i = 0; i < val.size(); i++) {
|
||||||
|
res[i] = hsaToNativeJSObject(val.get(i));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return res;
|
if (val instanceof java.util.Map) {
|
||||||
}
|
var res = {};
|
||||||
if (val instanceof java.util.Map) {
|
var iter = val.keySet().iterator();
|
||||||
var res = {};
|
while (iter.hasNext()) {
|
||||||
var iter = val.keySet().iterator();
|
var key = iter.next();
|
||||||
while (iter.hasNext()) {
|
res[key] = hsaToNativeJSObject(val.get(key));
|
||||||
var key = iter.next();
|
}
|
||||||
res[key] = hsaToNativeJSObject(val.get(key));
|
return res;
|
||||||
|
}
|
||||||
|
var classSimpleName = val.getClass().getSimpleName();
|
||||||
|
if (classSimpleName == 'Object[]') {
|
||||||
|
var res = [];
|
||||||
|
for (var i = 0; i < val.length; i++) {
|
||||||
|
res[i] = hsaToNativeJSObject(val[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user