예제 #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"));
 }
예제 #2
0
  public Comment(String str) throws WeiboException, JSONException {
    // StatusStream uses this constructor
    super();
    JSONObject json = new JSONObject(str);
    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");

    user = new User(json.getJSONObject("user"));
  }
예제 #3
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);
    }
  }