/*package*/ static ResponseList<User> createUserList(HttpResponse res, Configuration conf) throws FacebookException { try { if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); JSONArray list = json.getJSONArray("data"); final int size = list.length(); ResponseList<User> users = new ResponseListImpl<User>(size, json); for (int i = 0; i < size; i++) { JSONObject userJSONObject = list.getJSONObject(i); User user = new UserJSONImpl(userJSONObject); if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(user, userJSONObject); } users.add(user); } if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(users, list); } return users; } catch (JSONException jsone) { throw new FacebookException(jsone); } }
/*package*/ MessageJSONImpl(HttpResponse res, Configuration conf) throws FacebookException { super(res); JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); DataObjectFactoryUtil.registerJSONObject(this, json); } }
/*package*/ static List<User> createUserArray(HttpResponse res, Configuration conf) throws FacebookException { try { if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); List<User> users = new ArrayList<User>(); Iterator ids = json.keys(); while (ids.hasNext()) { String id = (String) ids.next(); User user = new UserJSONImpl((JSONObject) json.get(id)); users.add(user); } if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(users, json); } return users; } catch (JSONException jsone) { throw new FacebookException(jsone); } }
/*package*/ static ResponseList<Message> createMessageList(HttpResponse res, Configuration conf) throws FacebookException { try { if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); JSONArray list = json.getJSONArray("data"); int size = list.length(); ResponseList<Message> messages = new ResponseListImpl<Message>(size, json); for (int i = 0; i < size; i++) { Message message = new MessageJSONImpl(list.getJSONObject(i)); messages.add(message); } if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(messages, json); } return messages; } catch (JSONException jsone) { throw new FacebookException(jsone); } }
/*package*/ static ResponseList<Checkin> createCheckinList(HttpResponse res, Configuration conf) throws FacebookException { try { if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); JSONArray list = json.getJSONArray("data"); int size = list.length(); ResponseList<Checkin> checkins = new ResponseListImpl<Checkin>(size, json); for (int i = 0; i < size; i++) { Checkin checkin = new CheckinJSONImpl(list.getJSONObject(i)); checkins.add(checkin); } if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(checkins, json); } return checkins; } catch (JSONException jsone) { throw new FacebookException(jsone); } }
/*package*/ TestUserJSONImpl(HttpResponse res) throws FacebookException { JSONObject json = res.asJSONObject(); init(json); }