@Override public int compareTo(PersonNetwork member) { int ret = -1 * isHomeNetwork().compareTo(member.isHomeNetwork()); if (ret == 0) { ret = getId().compareTo(member.getId()); } return ret; }
@Override public void expected(Object o) { assertTrue(o instanceof PersonNetwork); PersonNetwork other = (PersonNetwork) o; AssertUtil.assertEquals("homeNetwork", homeNetwork, other.isHomeNetwork()); if (network != null) { network.expected(other.getNetwork()); } }
public static ListResponse<PersonNetwork> parseNetworkMembers(JSONObject jsonObject) { List<PersonNetwork> networkMembers = new ArrayList<PersonNetwork>(); JSONObject jsonList = (JSONObject) jsonObject.get("list"); assertNotNull(jsonList); JSONArray jsonEntries = (JSONArray) jsonList.get("entries"); assertNotNull(jsonEntries); for (int i = 0; i < jsonEntries.size(); i++) { JSONObject jsonEntry = (JSONObject) jsonEntries.get(i); JSONObject entry = (JSONObject) jsonEntry.get("entry"); networkMembers.add(PersonNetwork.parseNetworkMember(entry)); } ExpectedPaging paging = ExpectedPaging.parsePagination(jsonList); ListResponse<PersonNetwork> resp = new ListResponse<PersonNetwork>(paging, networkMembers); return resp; }