code: public <T extends HalRepresentation> void paginateAs(final String rel,
                                                           final Class<T> pageType,
                                                           final EmbeddedTypeInfo embeddedTypeInfo,
                                                           final PageHandler pageHandler) throws IOException {
          Optional<T> currentPage = getResourceAs(pageType, embeddedTypeInfo);
          while (currentPage.isPresent()
                  && pageHandler.apply(traverson(linkResolver).startWith(contextUrl, currentPage.get()))
                  && currentPage.get().getLinks().getRels().contains(rel)) {
              currentPage = follow(rel).getResourceAs(pageType, embeddedTypeInfo);
          }
      }
docs: Iterates over pages by following {code rel} links. For every page, a {@code Traverson} is created and provided as a
  parameter to the {@link PageHandler} function.
  
  <pre>
  &lt;rel&gt;
  ... --&gt; &lt;page type&gt; --&gt; &lt;page type&gt;
  |                |
  v N item         v N item
  &lt;embedded type&gt;   &lt;embedded type&gt;
  </pre>
  
  <p>
  The {@code Traverson} is backed by a representation of {@code pageType} with {@link EmbeddedTypeInfo}.
  This way it is possible to access items embedded into the page resources as specific subtypes of
  HalRepresentation.
  </p>
  
  <p>
  Iteration stops if the callback returns {@code false}, or if the last page is processed.
  </p>
  
  @param rel link-relation type of the links used to traverse pages
  @param pageType the subtype of HalRepresentation of the page resources
  @param embeddedTypeInfo type information of the (possibly embedded) items of a page
  @param pageHandler callback function called for every page
  @param <T> subtype of HalRepresentation
  @throws IOException if a low-level I/O problem (unexpected end-of-input, network error) occurs.
  @throws JsonParseException if the json document can not be parsed by Jackson's ObjectMapper
  @throws JsonMappingException if the input JSON structure can not be mapped to the specified HalRepresentation type
  @since 2.0.0