コード例 #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);
    }
  }