Package com.couchbase.client.java.view
Class DefaultViewResult
- java.lang.Object
-
- com.couchbase.client.java.view.DefaultViewResult
-
- All Implemented Interfaces:
ViewResult
,Iterable<ViewRow>
public class DefaultViewResult extends Object implements ViewResult
-
-
Constructor Summary
Constructors Constructor Description DefaultViewResult(CouchbaseEnvironment env, Bucket bucket, rx.Observable<AsyncViewRow> rows, int totalRows, boolean success, rx.Observable<JsonObject> error, JsonObject debug)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ViewRow>
allRows()
Collects all rows received from the view with the default view timeout.List<ViewRow>
allRows(long timeout, TimeUnit timeUnit)
Collects all rows received from the view with the default view timeout.JsonObject
debug()
If debug was enabled on the query, it is contained here.JsonObject
error()
If it was not successful, an error is contained here.JsonObject
error(long timeout, TimeUnit timeUnit)
If it was not successful, an error is contained here.Iterator<ViewRow>
iterator()
Iterator<ViewRow>
rows()
Emits oneViewRow
for each row received from the view with the default view timeout.Iterator<ViewRow>
rows(long timeout, TimeUnit timeUnit)
Emits oneViewRow
for each row received from the view with a custom timeout.boolean
success()
If the query was successful.int
totalRows()
The total number of rows.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultViewResult
public DefaultViewResult(CouchbaseEnvironment env, Bucket bucket, rx.Observable<AsyncViewRow> rows, int totalRows, boolean success, rx.Observable<JsonObject> error, JsonObject debug)
-
-
Method Detail
-
allRows
public List<ViewRow> allRows()
Description copied from interface:ViewResult
Collects all rows received from the view with the default view timeout. This method throws: -TimeoutException
wrapped in aRuntimeException
: If the timeout is exceeded.- Specified by:
allRows
in interfaceViewResult
- Returns:
- a (potentially empty)
List
containing view rows.
-
allRows
public List<ViewRow> allRows(long timeout, TimeUnit timeUnit)
Description copied from interface:ViewResult
Collects all rows received from the view with the default view timeout. This method throws: -TimeoutException
wrapped in aRuntimeException
: If the timeout is exceeded.- Specified by:
allRows
in interfaceViewResult
- Returns:
- a (potentially empty)
List
containing view rows.
-
rows
public Iterator<ViewRow> rows()
Description copied from interface:ViewResult
Emits oneViewRow
for each row received from the view with the default view timeout. This method throws: -TimeoutException
wrapped in aRuntimeException
: If the timeout is exceeded.- Specified by:
rows
in interfaceViewResult
- Returns:
- a (potentially empty)
Iterator
containing view rows.
-
rows
public Iterator<ViewRow> rows(long timeout, TimeUnit timeUnit)
Description copied from interface:ViewResult
Emits oneViewRow
for each row received from the view with a custom timeout. This method throws: -TimeoutException
wrapped in aRuntimeException
: If the timeout is exceeded.- Specified by:
rows
in interfaceViewResult
- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a (potentially empty)
Iterator
containing view rows.
-
totalRows
public int totalRows()
Description copied from interface:ViewResult
The total number of rows.- Specified by:
totalRows
in interfaceViewResult
- Returns:
- number of rows.
-
success
public boolean success()
Description copied from interface:ViewResult
If the query was successful.- Specified by:
success
in interfaceViewResult
- Returns:
- true if it was, false otherwise.
-
error
public JsonObject error()
Description copied from interface:ViewResult
If it was not successful, an error is contained here.- Specified by:
error
in interfaceViewResult
- Returns:
- the potential error.
-
error
public JsonObject error(long timeout, TimeUnit timeUnit)
Description copied from interface:ViewResult
If it was not successful, an error is contained here.- Specified by:
error
in interfaceViewResult
- Returns:
- the potential error.
-
debug
public JsonObject debug()
Description copied from interface:ViewResult
If debug was enabled on the query, it is contained here.- Specified by:
debug
in interfaceViewResult
- Returns:
- the debug info.
-
-