List of usage examples for org.springframework.social.facebook.api PagedList PagedList
public PagedList(List<T> unpagedList, PagingParameters previousPage, PagingParameters nextPage)
From source file:org.springframework.social.facebook.api.impl.FacebookTemplate.java
private <T> PagedList<T> pagify(Class<T> type, JsonNode jsonNode) { List<T> data = deserializeDataList(jsonNode.get("data"), type); if (jsonNode.has("paging")) { JsonNode pagingNode = jsonNode.get("paging"); PagingParameters previousPage = getPagedListParameters(pagingNode, "previous"); PagingParameters nextPage = getPagedListParameters(pagingNode, "next"); return new PagedList<T>(data, previousPage, nextPage); }/* w ww .ja va2 s . c om*/ return new PagedList<T>(data, null, null); }
From source file:org.springframework.social.facebook.api.impl.FeedTemplate.java
private <T> PagedList<T> deserializeList(JsonNode jsonNode, String postType, Class<T> type) { JsonNode dataNode = jsonNode.get("data"); List<T> posts = new ArrayList<T>(); for (Iterator<JsonNode> iterator = dataNode.iterator(); iterator.hasNext();) { posts.add(deserializePost(postType, type, (ObjectNode) iterator.next())); }//w w w . ja v a 2 s . c om if (jsonNode.has("paging")) { JsonNode pagingNode = jsonNode.get("paging"); PagingParameters previousPage = getPagedListParameters(pagingNode, "previous"); PagingParameters nextPage = getPagedListParameters(pagingNode, "next"); return new PagedList<T>(posts, previousPage, nextPage); } return new PagedList<T>(posts, null, null); }