code: public final Links links(final UriTemplate pageUriTemplate, final EnumSet<PagingRel> rels) {
          final List<Link> links = new ArrayList<>();
          if (rels.contains(PagingRel.SELF)) {
              links.add(
                      self(pageUri(pageUriTemplate, pageNumber, pageSize))
              );
          }
          if (rels.contains(PagingRel.FIRST)) {
              links.add(
                      link("first", pageUri(pageUriTemplate, firstPage, pageSize))
              );
          }
          if (pageNumber > firstPage && rels.contains(PagingRel.PREV)) {
              links.add(
                      link("prev", pageUri(pageUriTemplate, pageNumber-1, pageSize))
              );
          }
          if (hasMore && rels.contains(PagingRel.NEXT)) {
              links.add(
                      link("next", pageUri(pageUriTemplate, pageNumber+1, pageSize))
              );
          }
          if (total.isPresent() && rels.contains(PagingRel.LAST)) {
              links.add(
                      link("last", pageUri(pageUriTemplate, calcLastPage(this.total.getAsInt(), this.pageSize), pageSize))
              );
          }
          return linkingTo().single(links).build();
      }
docs: Return the requested links for a paged resource were the link's hrefs are created using the given
  {@link UriTemplate}.
  <p>
  The variables used to identify the current page number and page size must match the values returned
  by {@link #pageNumberVar()} and {@link #pageSizeVar()}. Derive from this class, if other values than
  {@link #PAGE_NUMBER_VAR} or {@link #PAGE_SIZE_VAR} are required.
  </p>
  <p>
  If the provided template does not contain the required variable names. links can not be expanded.
  </p>
  @param pageUriTemplate the URI template used to create paging links.
  @param rels the links expected to be created.
  @return paging links