Esempio n. 1
0
 /* modify by hezhou add some field*/
 public Comment(JSONObject json) throws WeiboException, JSONException {
   id = json.getLong("id");
   text = json.getString("text");
   source = json.getString("source");
   createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
   if (!json.isNull("user")) user = new User(json.getJSONObject("user"));
 }
Esempio n. 2
0
  /*modify by sycheng add json define */
  /*package*/ Comment(Response res) throws WeiboException {
    super(res);
    JSONObject json = res.asJSONObject();
    try {
      id = json.getLong("id");
      text = json.getString("text");
      source = json.getString("source");
      createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");

      if (!json.isNull("user")) user = new User(json.getJSONObject("user"));
    } catch (JSONException je) {
      throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
    }
  }