com.cumulocity.model.pagination
Class Page<T>

java.lang.Object
  extended by com.cumulocity.model.pagination.Page<T>

public class Page<T>
extends Object

This class wraps a query result subset according to the page request. Page numbering starts from 1.


Constructor Summary
Page()
           
Page(List<T> content, int currentPage, int pageSize, long totalElements)
          Constructs a page from a list of Items, the currentPage, pageSize and Number of totalElements.
Page(List<T> allItems, PageRequest request)
          Construct a Page from a list of all available items and a pageRequest.
Page(List<T> content, PageRequest request, long totalElements)
          Construct a page from a list of items, a page Request and the Number of totalElements.
 
Method Summary
 List<T> getContent()
           
 int getCurrentPage()
           
 int getPageSize()
           
 long getTotalElements()
           
 Integer getTotalPages()
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 void setContent(List<T> content)
           
 void setCurrentPage(int currentPage)
           
 void setPageSize(int pageSize)
           
 void setTotalElements(long totalElements)
           
 void setTotalPages(Integer totalPages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Page

public Page()

Page

public Page(List<T> content,
            PageRequest request,
            long totalElements)
Construct a page from a list of items, a page Request and the Number of totalElements. The Number of total Pages is calculated from the other values.

Parameters:
content -
request -
totalElements -

Page

public Page(List<T> content,
            int currentPage,
            int pageSize,
            long totalElements)
Constructs a page from a list of Items, the currentPage, pageSize and Number of totalElements. The Number of total Pages is calculated from the other values.

Parameters:
content -
currentPage -
pageSize -
totalElements -

Page

public Page(List<T> allItems,
            PageRequest request)
Construct a Page from a list of all available items and a pageRequest. Please not that this should only be used for small lists. It is usually better to filter within the database than retrieving all items and filter here.

Parameters:
allItems -
Method Detail

setContent

public void setContent(List<T> content)

getContent

public List<T> getContent()

setPageSize

public void setPageSize(int pageSize)

getPageSize

public int getPageSize()

setCurrentPage

public void setCurrentPage(int currentPage)

getCurrentPage

public int getCurrentPage()

setTotalPages

public void setTotalPages(Integer totalPages)

getTotalPages

public Integer getTotalPages()

setTotalElements

public void setTotalElements(long totalElements)

getTotalElements

public long getTotalElements()

hasNext

public boolean hasNext()

hasPrevious

public boolean hasPrevious()


Copyright © 2013 (C) Cumulocity GmbH. All Rights Reserved.