Exemplo n.º 1
0
 public School(Response res) throws WeiboException {
   super(res);
   JSONObject json = res.asJSONObject();
   try {
     id = json.getInt("id");
     name = json.getString("name");
   } catch (JSONException je) {
     throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
   }
 }
Exemplo n.º 2
0
 public static List<School> constructSchool(Response res) throws WeiboException {
   try {
     JSONArray list = res.asJSONArray();
     int size = list.length();
     List<School> schools = new ArrayList<School>(size);
     for (int i = 0; i < size; i++) {
       schools.add(new School(list.getJSONObject(i)));
     }
     return schools;
   } catch (JSONException jsone) {
     throw new WeiboException(jsone);
   } catch (WeiboException te) {
     throw te;
   }
 }