static <K, V> ViewQueryParameters<K, V> reversePaginationQueryParameters
    (ViewQueryParameters<K, V> initialQueryParameters, K startkey, String startkey_docid) {
        // Get a copy of the parameters, using the forward pagination method
        ViewQueryParameters<K, V> reversedParameters = forwardPaginationQueryParameters
                (initialQueryParameters, startkey,
                        startkey_docid);

        // Now reverse some of the parameters to page backwards.
        // Paging backward is descending from the original direction.
        reversedParameters.setDescending(!initialQueryParameters.getDescending());

        // We must always include our start key if paging backwards so inclusive end is true
        reversedParameters.setInclusiveEnd(true);

        // Any initial startkey is now the end key because we are reversed from original direction
        if (startkey != null) {
            reversedParameters.endkey = initialQueryParameters.startkey;
        }
        if (startkey_docid != null) {
            reversedParameters.setEndKeyDocId(initialQueryParameters.startkey_docid);
        }

        return reversedParameters;
    }
static < K , V > ViewQueryParameters < K , V > reversePaginationQueryParameters ( ViewQueryParameters < K , V > initialQueryParameters , K startkey , String startkey_docid ) { ViewQueryParameters < K , V > reversedParameters = forwardPaginationQueryParameters ( initialQueryParameters , startkey , startkey_docid ) ; reversedParameters . setDescending ( ! initialQueryParameters . getDescending ( ) ) ; reversedParameters . setInclusiveEnd ( true ) ; if ( startkey != null ) { reversedParameters . endkey = initialQueryParameters . startkey ; } if ( startkey_docid != null ) { reversedParameters . setEndKeyDocId ( initialQueryParameters . startkey_docid ) ; } return reversedParameters ; }
Generate query parameters for the backward page with the specified startkey.
<P>
Pages only have a reference to the start key, when paging backwards this is the
startkey of the following page (i.e. the last element of the previous page) so to
correctly present page results when paging backwards requires some parameters to
be reversed for the previous page request
</P>

@param initialQueryParameters page 1 query parameters
@param startkey               the startkey for the backward page
@param startkey_docid         the doc id for the start key (in case of duplicate keys)
@param <K>                    the view key type
@param <V>                    the view value type
@return the query parameters for the backward page.