Spring Data Commons

org.springframework.data.domain
Interface Page<T>

Type Parameters:
T -
All Superinterfaces:
java.lang.Iterable<T>
All Known Implementing Classes:
PageImpl

public interface Page<T>
extends java.lang.Iterable<T>

A page is a sublist of a list of objects. It allows gain information about the position of it in the containing entire list.

Author:
Oliver Gierke

Method Summary
 java.util.List<T> getContent()
          Returns the page content as List.
 int getNumber()
          Returns the number of the current page.
 int getNumberOfElements()
          Returns the number of elements currently on this page.
 int getSize()
          Returns the size of the page.
 Sort getSort()
          Returns the sorting parameters for the page.
 long getTotalElements()
          Returns the total amount of elements.
 int getTotalPages()
          Returns the number of total pages.
 boolean hasContent()
          Returns whether the Page has content at all.
 boolean hasNextPage()
          Returns if there is a next page.
 boolean hasPreviousPage()
          Returns if there is a previous page.
 boolean isFirstPage()
          Returns whether the current page is the first one.
 boolean isLastPage()
          Returns whether the current page is the last one.
 java.util.Iterator<T> iterator()
           
 

Method Detail

getNumber

int getNumber()
Returns the number of the current page. Is always positive and less that Page#getTotalPages().

Returns:
the number of the current page

getSize

int getSize()
Returns the size of the page.

Returns:
the size of the page

getTotalPages

int getTotalPages()
Returns the number of total pages.

Returns:
the number of toral pages

getNumberOfElements

int getNumberOfElements()
Returns the number of elements currently on this page.

Returns:
the number of elements currently on this page

getTotalElements

long getTotalElements()
Returns the total amount of elements.

Returns:
the total amount of elements

hasPreviousPage

boolean hasPreviousPage()
Returns if there is a previous page.

Returns:
if there is a previous page

isFirstPage

boolean isFirstPage()
Returns whether the current page is the first one.

Returns:

hasNextPage

boolean hasNextPage()
Returns if there is a next page.

Returns:
if there is a next page

isLastPage

boolean isLastPage()
Returns whether the current page is the last one.

Returns:

iterator

java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

getContent

java.util.List<T> getContent()
Returns the page content as List.

Returns:

hasContent

boolean hasContent()
Returns whether the Page has content at all.

Returns:

getSort

Sort getSort()
Returns the sorting parameters for the page.

Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.