예제 #1
0
 /*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);
   }
 }
예제 #2
0
 /*package*/ UserJSONImpl(HttpResponse res, Configuration conf) throws FacebookException {
   if (conf.isJSONStoreEnabled()) {
     DataObjectFactoryUtil.clearThreadLocalMap();
   }
   JSONObject json = res.asJSONObject();
   init(json);
   if (conf.isJSONStoreEnabled()) {
     DataObjectFactoryUtil.registerJSONObject(this, json);
   }
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof z_F4JInternalJSONImplFactory)) return false;

    z_F4JInternalJSONImplFactory that = (z_F4JInternalJSONImplFactory) o;

    if (conf != null ? !conf.equals(that.conf) : that.conf != null) return false;

    return true;
  }
예제 #4
0
 /*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);
   }
 }
예제 #5
0
 /*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);
   }
 }
예제 #6
0
 /*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);
   }
 }
 @Override
 public int hashCode() {
   return conf != null ? conf.hashCode() : 0;
 }