/** * Does this connection have a next page of data? * * @return {@code true} if there is a next page of data for this connection, * {@code false} otherwise. */ public boolean hasNext() { return !isBlank(getNextPageUrl()); } }
/** * Fetches the next page of the connection. Designed to be used by {@link Itr}. * * @return The next page of the connection. * @since 1.6.7 */ protected Connection<T> fetchNextPage() { return facebookClient.fetchConnectionPage(getNextPageUrl(), connectionType); }
/** * Does this connection have a next page of data? * * @return {@code true} if there is a next page of data for this connection, {@code false} otherwise. */ public boolean hasNext() { return !isBlank(getNextPageUrl()) && !getData().isEmpty() && !isSameCursor(); }
/** * @see com.restfb.FacebookClient#fetchConnection(java.lang.String, java.lang.Class, com.restfb.Parameter[]) */ @Override public <T> Connection<T> fetchConnection(String connection, Class<T> connectionType, Parameter... parameters) { verifyParameterPresence("connection", connection); verifyParameterPresence("connectionType", connectionType); Connection<T> conn = new Connection<>(this, makeRequest(connection, parameters), connectionType); if (conn.getNextPageUrl() == null && conn.getAfterCursor() != null) { String fullUrl = createEndpointForApiCall(connection, false); String paramString = toParameterString(parameters); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl + "?" + paramString, "after", conn.getAfterCursor()); conn.setNextPageUrl(fullUrl); } if (conn.getPreviousPageUrl() == null && conn.getBeforeCursor() != null) { String fullUrl = createEndpointForApiCall(connection, false); String paramString = toParameterString(parameters); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl + "?" + paramString, "before", conn.getBeforeCursor()); conn.setPreviousPageUrl(fullUrl); } return conn; }
if (conn.getNextPageUrl() == null && conn.getAfterCursor() != null) { String fullUrl = UrlUtils.removeQueryParameter(connectionPageUrl, "before"); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl, "after", conn.getAfterCursor());