com.capitalone.dashboard.util.PaginationHeaderUtility Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-audit Show documentation
Show all versions of api-audit Show documentation
Hygieia Audit Rest API Layer
package com.capitalone.dashboard.util;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
@Component
public class PaginationHeaderUtility {
public HttpHeaders buildPaginationHeaders(Page page) {
HttpHeaders headers = new HttpHeaders();
headers.add("totalEntities", String.valueOf(page.getTotalElements()));
headers.add("totalPages", String.valueOf(page.getTotalPages()));
headers.add("lastPage", String.valueOf(page.isLast()));
headers.add("pageSize", String.valueOf(page.getSize()));
headers.add("currentPage", String.valueOf(page.getNumber()));
headers.add("firstPage", String.valueOf(page.isFirst()));
headers.add("nextPage", String.valueOf(page.hasNext()));
return headers;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy