Spring Data Core

org.springframework.data.geo
Class GeoPage<T>

java.lang.Object
  extended by org.springframework.data.domain.PageImpl<GeoResult<T>>
      extended by org.springframework.data.geo.GeoPage<T>
All Implemented Interfaces:
Serializable, Iterable<GeoResult<T>>, Page<GeoResult<T>>, Slice<GeoResult<T>>

public class GeoPage<T>
extends PageImpl<GeoResult<T>>

Custom Page to carry the average distance retrieved from the GeoResults the GeoPage is set up from.

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

Constructor Summary
GeoPage(GeoResults<T> results)
          Creates a new GeoPage from the given GeoResults.
GeoPage(GeoResults<T> results, Pageable pageable, long total)
          Creates a new GeoPage from the given GeoResults, Pageable and total.
 
Method Summary
 Distance getAverageDistance()
          Returns the average distance of the underlying results.
 List<T> getContent()
          Returns the page content as List.
 int getNumber()
          Returns the number of the current Slice.
 int getNumberOfElements()
          Returns the number of elements currently on this Slice.
 int getSize()
          Returns the size of the Slice.
 Sort getSort()
          Returns the sorting parameters for the Slice.
 boolean hasContent()
          Returns whether the Slice has content at all.
 boolean hasPrevious()
          Returns if there is a previous Slice.
 boolean isFirst()
          Returns whether the current Slice is the first one.
 Iterator<T> iterator()
           
 Pageable nextPageable()
          Returns the Pageable to request the next Slice.
 Pageable previousPageable()
          Returns the Pageable to request the previous Slice.
 
Methods inherited from class org.springframework.data.domain.PageImpl
equals, getTotalElements, getTotalPages, hashCode, hasNext, hasNextPage, hasPreviousPage, isFirstPage, isLast, isLastPage, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.data.domain.Slice
getContent, getNumber, getNumberOfElements, getSize, getSort, hasContent, hasPrevious, isFirst, nextPageable, previousPageable
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

GeoPage

public GeoPage(GeoResults<T> results)
Creates a new GeoPage from the given GeoResults.

Parameters:
content - must not be null.

GeoPage

public GeoPage(GeoResults<T> results,
               Pageable pageable,
               long total)
Creates a new GeoPage from the given GeoResults, Pageable and total.

Parameters:
results - must not be null.
pageable - must not be null.
total -
Method Detail

getAverageDistance

public Distance getAverageDistance()
Returns the average distance of the underlying results.

Returns:
the averageDistance

getNumber

public int getNumber()
Description copied from interface: Slice
Returns the number of the current Slice. Is always non-negative.

Specified by:
getNumber in interface Slice<T>
Returns:
the number of the current Slice.

getSize

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

Specified by:
getSize in interface Slice<T>
Returns:
the size of the Slice.

getNumberOfElements

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

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

hasPrevious

public boolean hasPrevious()
Description copied from interface: Slice
Returns if there is a previous Slice.

Specified by:
hasPrevious in interface Slice<T>
Returns:
if there is a previous Slice.

isFirst

public boolean isFirst()
Description copied from interface: Slice
Returns whether the current Slice is the first one.

Specified by:
isFirst in interface Slice<T>
Returns:

nextPageable

public Pageable nextPageable()
Description copied from interface: Slice
Returns the Pageable to request the next Slice. Can be null in case the current Slice is already the last one. Clients should check Slice.hasNext() before calling this method to make sure they receive a non-null value.

Specified by:
nextPageable in interface Slice<T>
Returns:

previousPageable

public Pageable previousPageable()
Description copied from interface: Slice
Returns the Pageable to request the previous Slice. Can be null in case the current Slice is already the first one. Clients should check Slice.hasPrevious() before calling this method make sure receive a non-null value.

Specified by:
previousPageable in interface Slice<T>
Returns:

hasContent

public boolean hasContent()
Description copied from interface: Slice
Returns whether the Slice has content at all.

Specified by:
hasContent in interface Slice<T>
Returns:

getContent

public List<T> getContent()
Description copied from interface: Slice
Returns the page content as List.

Specified by:
getContent in interface Slice<T>
Returns:

getSort

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

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

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

Spring Data Core

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