ScriptObjectMirror转Java类型

private Object unwrapObject(Object scriptObj) {
if (scriptObj instanceof ScriptObjectMirror) {
ScriptObjectMirror scriptObjectMirror = (ScriptObjectMirror) scriptObj;
if (scriptObjectMirror.isArray()) {
List<Object> list = new ArrayList<>();
for (Map.Entry<String, Object> entry : scriptObjectMirror.entrySet()) {
list.add(convertIntoJavaObject(entry.getValue()));
}
return list;
} else {
Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, Object> entry : scriptObjectMirror.entrySet()) {
map.put(entry.getKey(), convertIntoJavaObject(entry.getValue()));
}
return map;
}
} else {
return scriptObj;
}
}