I also saw a ver similar question in the spring-hateoas repository in github but the answer was to ask in stackoverflow.
I'm using spring-hateoas PagedResources in my project for the return response of API endpoints. I now have an API endpoint where the count information will not be available so I'm using a Slice instead of a Page. However, when building the response I did not find a SlicedResources, only PagedResources class, and the PagedResources class requires information that I don't want to query for or send (like total number of elements).
This is what I do to create the metadata response for pages:
final PageMetadata metadata = new PageMetadata(page.getSize(), page.getNumber(), page.getTotalElements(), page.getTotalPages());
I was wondering if there is a recommended way to do what I'm doing for pages but for Slices instead, or if this is just not implemented in spring-hateoas.