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.HashMap);
|
||||
|
||||
@ -51,21 +52,31 @@ function hsaParseParamObject(o) {
|
||||
}
|
||||
|
||||
function hsaToNativeJSObject(val) {
|
||||
if (val instanceof java.util.List) {
|
||||
var res = [];
|
||||
for (var i = 0; i < val.size(); i++) {
|
||||
res[i] = hsaToNativeJSObject(val.get(i));
|
||||
if (val instanceof java.lang.Object) {
|
||||
if (val instanceof java.util.List) {
|
||||
var res = [];
|
||||
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 = {};
|
||||
var iter = val.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
var key = iter.next();
|
||||
res[key] = hsaToNativeJSObject(val.get(key));
|
||||
if (val instanceof java.util.Map) {
|
||||
var res = {};
|
||||
var iter = val.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user