Java Code Examples for org.springframework.data.domain.Page.isLast()

The following are Jave code examples for showing how to use isLast() of the org.springframework.data.domain.Page class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: role-api   File: HateoasPaginationHeadersBuilder.java   Source Code and License Vote up 6 votes
/**
 * {@inheritDoc}
 */
@Override
public HttpHeaders addPaginationData(HttpHeaders headers, Page<?> page) {
	addHeaderAndLog(headers, ApiHttpHeaders.TOTAL_COUNT, this.totalCountHeaderBuilder.buildTotal(page));

	if (!page.isFirst()) {
		addHeaderAndLog(headers, ApiHttpHeaders.LINK, this.linkHeaderBuilder.buildFirst());
	}

	if (!page.isLast()) {
		addHeaderAndLog(headers, ApiHttpHeaders.LINK, this.linkHeaderBuilder.buildLast(page));
	}

	if (page.hasPrevious()) {
		addHeaderAndLog(headers, ApiHttpHeaders.LINK, this.linkHeaderBuilder.buildPrev(page));
	}

	if (page.hasNext()) {
		addHeaderAndLog(headers, ApiHttpHeaders.LINK, this.linkHeaderBuilder.buildNext(page));
	}

	return headers;
}