Spring Data Core

org.springframework.data.domain
Class PageRequest

java.lang.Object
  extended by org.springframework.data.domain.AbstractPageRequest
      extended by org.springframework.data.domain.PageRequest
All Implemented Interfaces:
Serializable, Pageable

public class PageRequest
extends AbstractPageRequest

Basic Java Bean implementation of Pageable.

Author:
Oliver Gierke, Thomas Darimont
See Also:
Serialized Form

Constructor Summary
PageRequest(int page, int size)
          Creates a new PageRequest.
PageRequest(int page, int size, Sort.Direction direction, String... properties)
          Creates a new PageRequest with sort parameters applied.
PageRequest(int page, int size, Sort sort)
          Creates a new PageRequest with sort parameters applied.
 
Method Summary
 boolean equals(Object obj)
           
 Pageable first()
          Returns the Pageable requesting the first page.
 Sort getSort()
          Returns the sorting parameters.
 int hashCode()
           
 Pageable next()
          Returns the Pageable requesting the next Page.
 PageRequest previous()
          Returns the Pageable requesting the previous Page.
 String toString()
           
 
Methods inherited from class org.springframework.data.domain.AbstractPageRequest
getOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirst
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageRequest

public PageRequest(int page,
                   int size)
Creates a new PageRequest. Pages are zero indexed, thus providing 0 for page will return the first page.

Parameters:
page - zero-based page index.
size - the size of the page to be returned.

PageRequest

public PageRequest(int page,
                   int size,
                   Sort.Direction direction,
                   String... properties)
Creates a new PageRequest with sort parameters applied.

Parameters:
page - zero-based page index.
size - the size of the page to be returned.
direction - the direction of the Sort to be specified, can be null.
properties - the properties to sort by, must not be null or empty.

PageRequest

public PageRequest(int page,
                   int size,
                   Sort sort)
Creates a new PageRequest with sort parameters applied.

Parameters:
page - zero-based page index.
size - the size of the page to be returned.
sort - can be null.
Method Detail

getSort

public Sort getSort()
Description copied from interface: Pageable
Returns the sorting parameters.

Returns:

next

public Pageable next()
Description copied from interface: Pageable
Returns the Pageable requesting the next Page.

Specified by:
next in interface Pageable
Specified by:
next in class AbstractPageRequest
Returns:

previous

public PageRequest previous()
Description copied from class: AbstractPageRequest
Returns the Pageable requesting the previous Page.

Specified by:
previous in class AbstractPageRequest
Returns:

first

public Pageable first()
Description copied from interface: Pageable
Returns the Pageable requesting the first page.

Specified by:
first in interface Pageable
Specified by:
first in class AbstractPageRequest
Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractPageRequest

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractPageRequest

toString

public String toString()
Overrides:
toString in class Object

Spring Data Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.