code: public final Links links(final UriTemplate pageUriTemplate, final EnumSet<PagingRel> rels) {
          final List<Link> links = new ArrayList<>();
          if (rels.contains(SELF)) {
              links.add(
                      self(pageUri(pageUriTemplate, skip, limit))
              );
          }
          if (rels.contains(FIRST)) {
              links.add(
                      link("first", pageUri(pageUriTemplate, 0, limit))
              );
          }
          if (skip > 0 && rels.contains(PREV)) {
              links.add(
                      link("prev", pageUri(pageUriTemplate, max(0, skip-limit), limit))
              );
          }
          if (hasMore && rels.contains(NEXT)) {
              links.add(
                      link("next", pageUri(pageUriTemplate, skip + limit, limit))
              );
          }
          if (total.isPresent() && rels.contains(LAST)) {
              final int skip = calcLastPageSkip(total.getAsInt(), this.skip, this.limit);
              links.add(
                      link("last", pageUri(pageUriTemplate, skip, limit))
              );
          }
          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 number of skipped items and page size must match the values returned
  by {@link #skipVar()} ()} and {@link #limitVar()}. Derive from this class, if other values than
  {@link #SKIP_VAR} or {@link #LIMIT_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