Class OldPaginator

  extended by net.spy.memcached.compat.SpyObject
      extended by com.couchbase.client.protocol.views.OldPaginator
All Implemented Interfaces:

public class OldPaginator
extends net.spy.memcached.compat.SpyObject
implements java.util.Iterator<ViewResponse>

The OldPaginator allows easy pagination over a ViewResult. It is recommended not to instantiate this object directly, but to obtain a reference through the CouchbaseClient object like this: View view = client.getView("design_doc", "viewname"); Query query = new Query(); int docsPerPage = 15; OldPaginator paginator = client.paginatedQuery(view, query, docsPerPage);

Constructor Summary
OldPaginator(CouchbaseClient client, View view, Query query, int numDocs)
          Create a new OldPaginator.
Method Summary
 boolean hasNext()
          Check if there is still a ViewResult left to fetch.
 ViewResponse next()
          Returns the next ViewResult object to iterate over.
 void remove()
          Remove is not supported while iterating over a ViewResult.
Methods inherited from class net.spy.memcached.compat.SpyObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public OldPaginator(CouchbaseClient client,
                    View view,
                    Query query,
                    int numDocs)
Create a new OldPaginator.

client - the CouchbaseClient object to run the queries on.
view - the instance of the View to run the Queries against.
query - the instance of the Query object for the params.
numDocs - the number of the documents to return per page (must be greater than zero).
Method Detail


public boolean hasNext()
Check if there is still a ViewResult left to fetch.

Specified by:
hasNext in interface java.util.Iterator<ViewResponse>
true or false whether there is a ViewResult set to return or not.


public ViewResponse next()
Returns the next ViewResult object to iterate over.

Specified by:
next in interface java.util.Iterator<ViewResponse>
the next ViewResult page.


public void remove()
Remove is not supported while iterating over a ViewResult.

Specified by:
remove in interface java.util.Iterator<ViewResponse>

Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.