/*package*/ static ResponseList<Relationship> createRelationshipList(HttpResponse res, Configuration conf) throws TwitterException { try { if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); } JSONArray list = res.asJSONArray(); int size = list.length(); ResponseList<Relationship> relationships = new ResponseListImpl<Relationship>(size, res); for (int i = 0; i < size; i++) { JSONObject json = list.getJSONObject(i); Relationship relationship = new RelationshipJSONImpl(json); if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(relationship, json); } relationships.add(relationship); } if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.registerJSONObject(relationships, list); } return relationships; } catch (JSONException jsone) { throw new TwitterException(jsone); } catch (TwitterException te) { throw te; } }
/*package*/ RelationshipJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { this(res, res.asJSONObject()); if (conf.isJSONStoreEnabled()) { DataObjectFactoryUtil.clearThreadLocalMap(); DataObjectFactoryUtil.registerJSONObject(this, res.asJSONObject()); } }