eu.etaxonomy.cdm.api.service.pager
Interface Pager<T>

Type Parameters:
T -
All Known Implementing Classes:
AbstractPagerImpl, DefaultPagerImpl, StringLabelPagerImpl

public interface Pager<T>

Abstract class that represents a single page in a set of objects returned from a query (possibly a subset of the total number of matching objects available). NOTE: Indices for objects and pages are 0-based.

Author:
ben

Method Summary
 Integer getCount()
          Get the total number of objects in this result set (not in this page).
 Integer getCurrentIndex()
          The index of this page.
 Integer getFirstRecord()
          Returns the index of the first record in this result set
 List<Integer> getIndices()
          Get a list of page indices for which labels are available.
 Integer getLastRecord()
          Returns the index of the last record in this result set
 Integer getNextIndex()
          The index of the next page in this result set, or null if this is the last page in the result set.
 String getPageNumber(int index)
          Get a string label for a given page (NOTE: Labels may not be calculated for each page in the result set, especially if the result set is large or the operation for calculating the label is expensive.
 Integer getPagesAvailable()
          The total number of pages available for this query, or 0 if there are no matching objects
 Integer getPageSize()
          Gets the size of pages in this result set.
 Integer getPrevIndex()
          The index of the previous page in this result set, or null if this is the first page in the result set.
 List<T> getRecords()
          Returns the records in this page.
 String getSuggestion()
          Returns a suggested query string (only applicable for free-text / lucene queries).
 

Method Detail

getPagesAvailable

Integer getPagesAvailable()
The total number of pages available for this query, or 0 if there are no matching objects

Returns:
The number of pages available

getNextIndex

Integer getNextIndex()
The index of the next page in this result set, or null if this is the last page in the result set.

Returns:
The index of the next page

getPrevIndex

Integer getPrevIndex()
The index of the previous page in this result set, or null if this is the first page in the result set.

Returns:
The index of the previous page

getCurrentIndex

Integer getCurrentIndex()
The index of this page. NOTE: Indices for objects and pages are 0-based.

Returns:
The index of this page

getPageNumber

String getPageNumber(int index)
Get a string label for a given page (NOTE: Labels may not be calculated for each page in the result set, especially if the result set is large or the operation for calculating the label is expensive. The indices of the pages for which labels are available are given by getIndices().

Parameters:
index -
Returns:
A label for the page indicated or null if this pager has not calculated a label for that page

getPageSize

Integer getPageSize()
Gets the size of pages in this result set. Can be null if all matching objects should be returned.

Returns:
The page size

getIndices

List<Integer> getIndices()
Get a list of page indices for which labels are available.

Returns:
A list of indices

getCount

Integer getCount()
Get the total number of objects in this result set (not in this page). If count > getPageSize() then getPagesAvailable() > 1

Returns:
the total number of objects available.

getFirstRecord

Integer getFirstRecord()
Returns the index of the first record in this result set

Returns:

getLastRecord

Integer getLastRecord()
Returns the index of the last record in this result set

Returns:

getRecords

List<T> getRecords()
Returns the records in this page.

Returns:

getSuggestion

String getSuggestion()
Returns a suggested query string (only applicable for free-text / lucene queries). Usually only calculated if there were no matching results for the original query.

Returns:


Copyright © 2007-2013 EDIT. All Rights Reserved.