K
- the type of key emitted by the viewV
- the type of value emitted by the viewpublic interface ViewRequest<K,V>
Modifier and Type | Method and Description |
---|---|
ViewResponse<K,V> |
getResponse()
Performs the request and returns the response.
|
V |
getSingleValue()
Performs the request and returns a single value.
|
ViewResponse<K,V> getResponse() throws java.io.IOException
Example usage:
ViewResponse<String, String> response = db.getViewRequestBuilder("designDoc","viewName")
.newRequest(Key.Type.STRING, String.class)
.build()
.getResponse();
java.io.IOException
- if there is an error communicating with the serverV getSingleValue() throws java.io.IOException
This is primarily intended for retrieving a single result (e.g. count) from a reduced view.
Example usage for a view with a "_count" reduce function:
Integer count = db.getViewRequestBuilder("designDoc","viewWithCount")
.newRequest(Key.Type.STRING, Integer.class)
.reduce(true) //this is the default, but shown for clarity
.build()
.getSingleValue();
null
if there were no rowsjava.io.IOException
- if there is an error communicating with the server