if (body.has("value") && body.isNull("value")) {
return (T) null;
}
if ("array".equals(body.optString("subtype"))) {
RemoteObject array = new RemoteObject(body.getString("objectId"), this);
RemoteObjectArray a = new RemoteObjectArray(array);
ArrayList<Object> res = new ArrayList<Object>();
for (Object ro : a) {
res.add(ro);
}
return (T) res;
}
if (body.has("objectId")) {
if ("node".equals(body.optString("subtype")) || "Window"
.equals(body.optString("className"))) {
return (T) new RemoteObject(body.getString("objectId"), this);
} else {
RemoteObject ro = new RemoteObject(body.getString("objectId"), this);
JSONObject o = new JSONObject(ro.stringify());
return (T) o;
}
}
return (T) new RemoteObject(body.getString("objectId"), this);
}
throw new RuntimeException("NI " + body);
}