public class LucenePage<T,K,V> extends AbstractPageSupport<T>
LucenePage
class is a Spring Data Page
implementation supporting Spring Data style paging
of PageableLuceneQueryResults
complete with Spring Data projections.List
,
LuceneResultStruct
,
PageableLuceneQueryResults
,
Page
,
AbstractPageSupport
,
ProjectingLuceneAccessor
Constructor and Description |
---|
LucenePage(ProjectingLuceneAccessor template,
org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults,
int pageSize,
Class<T> projectionType)
Constructs a new instance of
LucenePage initialized with
the given Lucene query results , page size
and projection type . |
LucenePage(ProjectingLuceneAccessor template,
org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults,
int pageSize,
Class<T> projectionType,
LucenePage<T,K,V> previous)
Constructs a new instance of
LucenePage initialized with
the given Lucene query results , page size ,
projection type and previous page , if one exists. |
Modifier and Type | Method and Description |
---|---|
List<T> |
getContent() |
LucenePage<T,K,V> |
getNext()
|
int |
getNumber() |
protected int |
getPageSize()
Returns the number of elements per
page . |
LucenePage<T,K,V> |
getPrevious()
|
protected Class<T> |
getProjectionType()
Returns the
Class type of the projection. |
protected org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> |
getQueryResults()
Returns the
Lucene query results backing this LucenePage . |
int |
getSize() |
protected ProjectingLuceneAccessor |
getTemplate()
Returns the
ProjectingLuceneAccessor used by this LucenePage to perform
Lucene data access operations and projections. |
long |
getTotalElements() |
int |
getTotalPages() |
boolean |
hasNext() |
boolean |
hasPrevious() |
<S> Page<S> |
map(Function<? super T,? extends S> converter) |
protected List<T> |
materialize(ProjectingLuceneAccessor template,
List<org.apache.geode.cache.lucene.LuceneResultStruct<K,V>> pageOfQueryResults,
Class<T> projectionType)
|
static <T,K,V> LucenePage<T,K,V> |
newLucenePage(ProjectingLuceneAccessor template,
org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults,
int pageSize,
Class<T> projectionType)
Factory method used to construct a new instance of
LucenePage initialized with
the given Lucene query results , page size ,
and projection type . |
static <T,K,V> LucenePage<T,K,V> |
newLucenePage(ProjectingLuceneAccessor template,
org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults,
int pageSize,
Class<T> projectionType,
LucenePage<T,K,V> previousPage)
Factory method used to construct a new instance of
LucenePage initialized with
the given Lucene query results , page size ,
projection type and previous page , if one exists. |
getNumberOfElements, getSort, hasContent, isFirst, isLast, iterator, nextPageable, previousPageable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNumberOfElements, getPageable, getSort, hasContent, isFirst, isLast, nextOrLastPageable, nextPageable, previousOrFirstPageable, previousPageable
and, and, and, and, filter, flatMap, get, isEmpty, of, of, of, stream, toList, toSet, toStreamable, toStreamable
forEach, iterator, spliterator
public LucenePage(ProjectingLuceneAccessor template, org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults, int pageSize, Class<T> projectionType)
LucenePage
initialized with
the given Lucene query results
, page size
and projection type
.
The previous page
is set to null.template
- ProjectingLuceneAccessor
used to perform Lucene queries and data access operations
along with projections.queryResults
- PageableLuceneQueryResults
wrapped by this LucenePage
.pageSize
- number of elements on a LucenePage
.projectionType
- Class
type of the projection used to view an individual LuceneResultStruct
in the Lucene query results
.IllegalArgumentException
- if ProjectingLuceneAccessor
or the PageableLuceneQueryResults
are null, or the PageableLuceneQueryResults
do not have
a next page
.LucenePage(ProjectingLuceneAccessor, PageableLuceneQueryResults, int, Class, LucenePage)
public LucenePage(ProjectingLuceneAccessor template, org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults, int pageSize, Class<T> projectionType, LucenePage<T,K,V> previous)
LucenePage
initialized with
the given Lucene query results
, page size
,
projection type
and previous page
, if one exists.template
- ProjectingLuceneAccessor
used to perform Lucene queries and data access operations
along with projections.queryResults
- PageableLuceneQueryResults
wrapped by this LucenePage
.pageSize
- number of elements on a LucenePage
.projectionType
- Class
type of the projection used to view an individual LuceneResultStruct
in the Lucene query results
.previous
- previous page
in the chain of pages
,
if this LucenePage
is not the first LucenePage
. Can be null.IllegalArgumentException
- if ProjectingLuceneAccessor
or the PageableLuceneQueryResults
are null, or the PageableLuceneQueryResults
do not have
a next page
.materialize(ProjectingLuceneAccessor, List, Class)
public static <T,K,V> LucenePage<T,K,V> newLucenePage(ProjectingLuceneAccessor template, org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults, int pageSize, Class<T> projectionType)
LucenePage
initialized with
the given Lucene query results
, page size
,
and projection type
.
The previous page
is set to null.template
- ProjectingLuceneAccessor
used to perform Lucene queries and data access operations
along with projections.queryResults
- PageableLuceneQueryResults
wrapped by this LucenePage
.pageSize
- number of elements on a LucenePage
.projectionType
- Class
type of the projection used to view an individual LuceneResultStruct
in the Lucene query results
.IllegalArgumentException
- if ProjectingLuceneAccessor
or the PageableLuceneQueryResults
are null, or the PageableLuceneQueryResults
do not have
a next page
.LucenePage(ProjectingLuceneAccessor, PageableLuceneQueryResults, int, Class)
public static <T,K,V> LucenePage<T,K,V> newLucenePage(ProjectingLuceneAccessor template, org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> queryResults, int pageSize, Class<T> projectionType, LucenePage<T,K,V> previousPage)
LucenePage
initialized with
the given Lucene query results
, page size
,
projection type
and previous page
, if one exists.template
- ProjectingLuceneAccessor
used to perform Lucene queries and data access operations
along with projections.queryResults
- PageableLuceneQueryResults
wrapped by this LucenePage
.pageSize
- number of elements on a LucenePage
.projectionType
- Class
type of the projection used to view an individual LuceneResultStruct
in the Lucene query results
.previousPage
- previous page
in the chain of pages
,
if this LucenePage
is not the first LucenePage
. Can be null.IllegalArgumentException
- if ProjectingLuceneAccessor
or the PageableLuceneQueryResults
are null, or the PageableLuceneQueryResults
do not have
a next page
.LucenePage(ProjectingLuceneAccessor, PageableLuceneQueryResults, int, Class, LucenePage)
protected List<T> materialize(ProjectingLuceneAccessor template, List<org.apache.geode.cache.lucene.LuceneResultStruct<K,V>> pageOfQueryResults, Class<T> projectionType)
template
- ProjectingLuceneAccessor
used to project the desired values
from the List
of LuceneResultStruct
objects.pageOfQueryResults
- Lucene query results captured in the List
of LuceneResultStruct
objects.projectionType
- Class
type to project the LuceneResultStruct
objects as.List
of projected values of the given projection type
.LuceneResultStruct
protected int getPageSize()
page
.page
.protected Class<T> getProjectionType()
Class
type of the projection.Class
specifying the projection type.protected org.apache.geode.cache.lucene.PageableLuceneQueryResults<K,V> getQueryResults()
Lucene query results
backing this LucenePage
.PageableLuceneQueryResults
backing this LucenePage
.LucenePage
,
PageableLuceneQueryResults
protected ProjectingLuceneAccessor getTemplate()
ProjectingLuceneAccessor
used by this LucenePage
to perform
Lucene data access operations and projections.ProjectingLuceneAccessor
used by this LucenePage
to perform
Lucene data access operations and projections.ProjectingLuceneAccessor
public boolean hasNext()
public boolean hasPrevious()
hasPrevious
in interface Slice<T>
hasPrevious
in class AbstractSliceSupport<T>
public List<T> getContent()
getContent
in interface Slice<T>
getContent
in class AbstractSliceSupport<T>
public LucenePage<T,K,V> getNext()
page
in the collection of pages
.IllegalStateException
- if no more pages
exist beyond this page
.LucenePage
,
getPrevious()
public int getNumber()
public LucenePage<T,K,V> getPrevious()
page
in the collection of pages
or null if no LucenePage
proceeds this page
.LucenePage
,
getNext()
public int getSize()
public long getTotalElements()
getTotalElements
in interface Page<T>
getTotalElements
in class AbstractPageSupport<T>
public int getTotalPages()
getTotalPages
in interface Page<T>
getTotalPages
in class AbstractPageSupport<T>
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.