|
| PagingPredicate (size_t predicatePageSize) |
| Construct with a pageSize results will not be filtered results will be natural ordered throws IllegalArgumentException IllegalArgumentException if pageSize is not greater than 0. More...
|
|
| PagingPredicate (std::auto_ptr< Predicate > predicate, size_t predicatePageSize) |
| Construct with an inner predicate and pageSize results will be filtered via inner predicate results will be natural ordered throws IllegalArgumentException IllegalArgumentException if pageSize is not greater than 0 throws IllegalArgumentException IllegalArgumentException if inner predicate is also PagingPredicate. More...
|
|
| PagingPredicate (std::auto_ptr< query::EntryComparator< K, V > > comparatorObj, size_t predicatePageSize) |
| Construct with a comparator and pageSize results will not be filtered results will be ordered via comparator throws IllegalArgumentException IllegalArgumentException if pageSize is not greater than 0. More...
|
|
| PagingPredicate (std::auto_ptr< Predicate > predicate, std::auto_ptr< query::EntryComparator< K, V > > comparatorObj, size_t predicatePageSize) |
| Construct with an inner predicate, comparator and pageSize results will be filtered via inner predicate results will be ordered via comparator throws IllegalArgumentException if pageSize is not greater than 0 throws IllegalArgumentException if inner predicate is also PagingPredicate. More...
|
|
void | reset () |
| resets for reuse
|
|
void | nextPage () |
| sets the page value to next page
|
|
void | previousPage () |
| sets the page value to previous page
|
|
IterationType | getIterationType () const |
|
void | setIterationType (IterationType type) |
|
size_t | getPage () const |
|
void | setPage (size_t pageNumber) |
|
size_t | getPageSize () const |
|
const Predicate * | getPredicate () const |
|
const query::EntryComparator
< K, V > * | getComparator () const |
|
const std::pair< K *, V * > * | getAnchor () const |
| Retrieve the anchor object which is the last value object on the previous page. More...
|
|
const std::pair< size_t,
std::pair< K *, V * > > * | getNearestAnchorEntry () |
| After each query, an anchor entry is set for that page. More...
|
|
int | getFactoryId () const |
|
int | getClassId () const |
|
void | writeData (serialization::ObjectDataOutput &out) const |
| Defines how this class will be written. More...
|
|
void | readData (serialization::ObjectDataInput &in) |
| Defines how this class will be read. More...
|
|
void | setAnchor (size_t page, const std::pair< K *, V * > &anchorEntry) |
|
virtual | ~IdentifiedDataSerializable () |
| Destructor.
|
|
template<typename K, typename V>
class hazelcast::client::query::PagingPredicate< K, V >
NOTE: PagingPredicate can only be used with values(), keySet() and entries() methods!!!
This class is a special Predicate which helps to get a page-by-page result of a query. It can be constructed with a page-size, an inner predicate for filtering, and a comparator for sorting. This class is not thread-safe and stateless. To be able to reuse for another query, one should call PagingPredicate#reset()
Here is an example usage.
Predicate lessEqualThanFour = Predicates.lessEqual("this", 4);
// We are constructing our paging predicate with a predicate and page size. In this case query results fetched two
by two.
PagingPredicate predicate = new PagingPredicate(lessEqualThanFour, 2);
// we are initializing our map with integers from 0 to 10 as keys and values.
IMap map = hazelcastInstance.getMap(...);
for (int i = 0; i < 10; i++) {
map.put(i, i);
}
// invoking the query
Collection<Integer> values = map.values(predicate);
System.out.println("values = " + values) // will print 'values = [0, 1]'
predicate.nextPage(); // we are setting up paging predicate to fetch next page in the next call.
values = map.values(predicate);
System.out.println("values = " + values);// will print 'values = [2, 3]'
Entry anchor = predicate.getAnchor();
System.out.println("anchor -> " + anchor); // will print 'anchor -> 1=1', since the anchor is the last entry of
the previous page.
predicate.previousPage(); // we are setting up paging predicate to fetch previous page in the next call
values = map.values(predicate);
System.out.println("values = " + values) // will print 'values = [0, 1]'