org.synyx.hades.domain
Class PageImpl<T>

java.lang.Object
  extended by org.synyx.hades.domain.PageImpl<T>
Type Parameters:
T - the type of which the page consists.
All Implemented Interfaces:
java.lang.Iterable<T>, Page<T>

public class PageImpl<T>
extends java.lang.Object
implements Page<T>

Basic Page implementation.

Author:
Oliver Gierke

Constructor Summary
PageImpl(java.util.List<T> content)
          Creates a new PageImpl with the given content.
PageImpl(java.util.List<T> content, Pageable pageable, long total)
          Constructor of PageImpl.
 
Method Summary
 java.util.List<T> asList()
          Returns the page content as List.
 boolean equals(java.lang.Object obj)
           
 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.
 int hashCode()
           
 boolean hasNextPage()
          Returns if there is a next page.
 boolean hasPreviousPage()
          Returns if there is a previous page.
 java.util.Iterator<T> iterator()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageImpl

public PageImpl(java.util.List<T> content,
                Pageable pageable,
                long total)
Constructor of PageImpl.

Parameters:
content - the content of this page
pageable - the paging information
total - the total amount of items available

PageImpl

public PageImpl(java.util.List<T> content)
Creates a new PageImpl with the given content. This will result in the created Page being identical to the entire List.

Parameters:
content -
Method Detail

getNumber

public int getNumber()
Description copied from interface: Page
Returns the number of the current page. Is always greater than zero and less that Page#getTotalPages().

Specified by:
getNumber in interface Page<T>
Returns:
the number of the current page

getSize

public int getSize()
Description copied from interface: Page
Returns the size of the page.

Specified by:
getSize in interface Page<T>
Returns:
the size of the page

getTotalPages

public int getTotalPages()
Description copied from interface: Page
Returns the number of total pages.

Specified by:
getTotalPages in interface Page<T>
Returns:
the number of toral pages

getNumberOfElements

public int getNumberOfElements()
Description copied from interface: Page
Returns the number of elements currently on this page.

Specified by:
getNumberOfElements in interface Page<T>
Returns:
the number of elements currently on this page

getTotalElements

public long getTotalElements()
Description copied from interface: Page
Returns the total amount of elements.

Specified by:
getTotalElements in interface Page<T>
Returns:
the total amount of elements

hasPreviousPage

public boolean hasPreviousPage()
Description copied from interface: Page
Returns if there is a previous page.

Specified by:
hasPreviousPage in interface Page<T>
Returns:
if there is a previous page

hasNextPage

public boolean hasNextPage()
Description copied from interface: Page
Returns if there is a next page.

Specified by:
hasNextPage in interface Page<T>
Returns:
if there is a next page

iterator

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

asList

public java.util.List<T> asList()
Description copied from interface: Page
Returns the page content as List.

Specified by:
asList in interface Page<T>
Returns:

getSort

public Sort getSort()
Description copied from interface: Page
Returns the sorting parameters for the page.

Specified by:
getSort in interface Page<T>
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2009-2010 Synyx GmbH & Co. KG. All Rights Reserved.