Esempio n. 1
0
 /**
  * @param res
  * @return
  * @throws WeiboException
  */
 static List<User> constructResult(Response res) throws WeiboException {
   JSONArray list = res.asJSONArray();
   try {
     int size = list.length();
     List<User> users = new ArrayList<User>(size);
     for (int i = 0; i < size; i++) {
       users.add(new User(list.getJSONObject(i)));
     }
     return users;
   } catch (JSONException e) {
   }
   return null;
 }
Esempio n. 2
0
 public static List<User> constructUsers(Response res) throws WeiboException {
   try {
     JSONArray list = res.asJSONArray();
     int size = list.length();
     List<User> users = new ArrayList<User>(size);
     for (int i = 0; i < size; i++) {
       users.add(new User(list.getJSONObject(i)));
     }
     return users;
   } catch (JSONException jsone) {
     throw new WeiboException(jsone);
   } catch (WeiboException te) {
     throw te;
   }
 }
Esempio n. 3
0
 /**
  * @param res
  * @return
  * @throws WeiboException
  */
 public static UserWapper constructWapperUsers(Response res) throws WeiboException {
   JSONObject jsonUsers = res.asJSONObject(); // asJSONArray();
   try {
     JSONArray user = jsonUsers.getJSONArray("users");
     int size = user.length();
     List<User> users = new ArrayList<User>(size);
     for (int i = 0; i < size; i++) {
       users.add(new User(user.getJSONObject(i)));
     }
     long previousCursor = jsonUsers.getLong("previous_curosr");
     long nextCursor = jsonUsers.getLong("next_cursor");
     if (nextCursor == -1) { // 兼容不同标签名称
       nextCursor = jsonUsers.getLong("nextCursor");
     }
     return new UserWapper(users, previousCursor, nextCursor);
   } catch (JSONException jsone) {
     throw new WeiboException(jsone);
   }
 }
Esempio n. 4
0
  public static List<User> constructUser(Response res) throws WeiboException {

    JSONObject json = res.asJSONObject();
    try {
      //			int next_cursor = json.getInt("next_cursor");
      //			int previous_cursor = json.getInt("previous_cursor");

      JSONArray list = json.getJSONArray("users");
      int size = list.length();
      List<User> users = new ArrayList<User>(size);
      for (int i = 0; i < size; i++) {
        users.add(new User(list.getJSONObject(i)));
      }
      return users;

    } catch (JSONException je) {
      throw new WeiboException(je);
    }
  }