Package weibo4j.org.json

Examples of weibo4j.org.json.JSONArray


     * @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;
View Full Code Here


     * @return response body as sinat4j.org.json.JSONArray
     * @throws WeiboException
     */
    public JSONArray asJSONArray() throws WeiboException {
        try {
          return  new JSONArray(asString())
        } catch (Exception jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + this.responseAsString, jsone);
        }
    }
View Full Code Here

      followers = json.getLong("followers");
    }
 
  static List<Count> constructCounts(Response res) throws WeiboException {
        try {
              JSONArray list = res.asJSONArray();
              int size = list.length();
              List<Count> counts = new ArrayList<Count>(size);
              for (int i = 0; i < size; i++) {
                counts.add(new Count(list.getJSONObject(i)));
              }
              return counts;
          } catch (JSONException jsone) {
              throw new WeiboException(jsone);
          } catch (WeiboException te) {
View Full Code Here

            JSONObject trendsJson = json.getJSONObject("trends");
            trends = new ArrayList<Trends>(trendsJson.length());
            Iterator ite = trendsJson.keys();
            while (ite.hasNext()) {
                String key = (String) ite.next();
                JSONArray array = trendsJson.getJSONArray(key);
                Trend[] trendsArray = jsonArrayToTrendArray(array);
                if (key.length() == 19) {
                    // current trends
                    trends.add(new Trends(res, asOf, parseDate(key
                            , "yyyy-MM-dd HH:mm:ss"), trendsArray));
View Full Code Here

    /*package*/
    static Trends constructTrends(Response res) throws WeiboException {
        JSONObject json = res.asJSONObject();
        try {
            Date asOf = parseDate(json.getString("as_of"));
            JSONArray array = json.getJSONArray("trends");
            Trend[] trendsArray = jsonArrayToTrendArray(array);
            return new Trends(res, asOf, asOf, trendsArray);
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + res.asString(), jsone);
        }
View Full Code Here

    }
    /*modify by sycheng add json*/
    /*package*/
    static List<RetweetDetails> createRetweetDetails(Response res) throws WeiboException {
      try {
            JSONArray list = res.asJSONArray();
            int size = list.length();
            List<RetweetDetails> retweets = new ArrayList<RetweetDetails>(size);
            for (int i = 0; i < size; i++) {
              retweets.add(new RetweetDetails(list.getJSONObject(i)));
            }
            return retweets;
        } catch (JSONException jsone) {
            throw new WeiboException(jsone);
        } catch (WeiboException te) {
View Full Code Here

    }
   
    /*package*/
    static List<DirectMessage> constructDirectMessages(Response res
                                                       ) throws WeiboException {
      JSONArray list=   res.asJSONArray();
     
            try {
                int size = list.length();
                List<DirectMessage> messages = new ArrayList<DirectMessage>(size);
                for (int i = 0; i < size; i++) {
                   
                    messages.add(new DirectMessage(list.getJSONObject(i)));
                }
                return messages;
            } catch (JSONException jsone) {
              throw new WeiboException(jsone);
            }
View Full Code Here

            resultsPerPage = json.getInt("results_per_page");
            warning = getString("warning", json, false);
            completedIn = json.getDouble("completed_in");
            page = json.getInt("page");
            query = getString("query", json, true);
            JSONArray array = json.getJSONArray("results");
            tweets = new ArrayList<Tweet>(array.length());
            for (int i = 0; i < array.length(); i++) {
                JSONObject tweet = array.getJSONObject(i);
                tweets.add(new Tweet(tweet, weiboSupport));
            }
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + json.toString(), jsone);
        }
View Full Code Here

    }
   
    /* modify by hezhou add some field*/
    static List<Comment> constructComments(Response res) throws WeiboException {
      try {
            JSONArray list = res.asJSONArray();
            int size = list.length();
            List<Comment> comments = new ArrayList<Comment>(size);
            for (int i = 0; i < size; i++) {
              comments.add(new Comment(list.getJSONObject(i)));
            }
            return comments;
        } catch (JSONException jsone) {
            throw new WeiboException(jsone);
        } catch (WeiboException te) {
View Full Code Here

    /*modify by sycheng add json call method*/
    /*package*/
    static List<Status> constructStatuses(Response res) throws WeiboException {
       try {
             JSONArray list = res.asJSONArray();
             int size = list.length();
             List<Status> statuses = new ArrayList<Status>(size);
             for (int i = 0; i < size; i++) {
                 statuses.add(new Status(list.getJSONObject(i)));
             }
             return statuses;
         } catch (JSONException jsone) {
             throw new WeiboException(jsone);
         } catch (WeiboException te) {
View Full Code Here

TOP

Related Classes of weibo4j.org.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.