Spring Framework UriComponentsBuilder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework UriComponentsBuilder class.

This code example shows how to use the following methods:replaceQueryParam
    final String constructPrevPageUri(final UriComponentsBuilder uriBuilder, final int page, final int size) {
        return uriBuilder.replaceQueryParam(PAGE, page - 1).replaceQueryParam("size", size).build().encode().toUriString();
    } 
 
    final String constructFirstPageUri(final UriComponentsBuilder uriBuilder, final int size) {
        return uriBuilder.replaceQueryParam(PAGE, 0).replaceQueryParam("size", size).build().encode().toUriString();
    } 
 
    final String constructLastPageUri(final UriComponentsBuilder uriBuilder, final int totalPages, final int size) {
        return uriBuilder.replaceQueryParam(PAGE, totalPages).replaceQueryParam("size", size).build().encode().toUriString();
    } 
 
    final boolean hasNextPage(final int page, final int totalPages) {
        return page < totalPages - 1;
    } 
 
    final boolean hasPreviousPage(final int page) {
        return page > 0;
    } 
 
3
CodeRank
See Code Examples for Spring Framework UriComponentsBuilder Methods: