JSONObject jso = (JSONObject) o;
String java_class;
try {
java_class = jso.getString(TAG_JAVACLASS);
} catch (JSONException e) {
throw new UnmarshallException("Could not read javaClass", e);
}
if (java_class == null) {
throw new UnmarshallException("no type hint");
}
AbstractList al;
if (java_class.equals("java.util.List") ||
java_class.equals("java.util.AbstractList") ||
java_class.equals("java.util.ArrayList")) {
al = new ArrayList();
} else if (java_class.equals("java.util.LinkedList")) {
al = new LinkedList();
} else if (java_class.equals("java.util.Vector")) {
al = new Vector();
} else {
throw new UnmarshallException("not a List");
}
JSONArray jsonlist;
try {
jsonlist = jso.getJSONArray("list");
} catch (JSONException e) {
throw new UnmarshallException("Could not read list: " + e.getMessage(), e);
}
if (jsonlist == null) {
throw new UnmarshallException("list missing");
}
state.setSerialized(o, al);
int i = 0;
try {
for (; i < jsonlist.length(); i++) {
al.add(_ser.unmarshall(state, null, jsonlist.get(i)));
}
} catch (UnmarshallException e) {
throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
} catch (JSONException e) {
throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
}
return al;
}