K
- the type of key emitted by the view, fixed by the
Key.Type
supplied to the
ViewRequestBuilder
V
- the type of value emitted by the view, specified when supplied to the
ViewRequestBuilder
public interface ViewMultipleRequest<K,V>
A convenience class for performing multiple unpaginated query requests on a single view.
The request is built by a MultipleRequestBuilder
.
Example usage:
List<ViewResponse<String, String>> responses =
//get a builder for the "alpha" view of the "directory" design doc
db.getViewRequestBuilder("directory","alpha")
//create a new multi request expecting String keys and values
.newMultipleRequest(Key.Type.STRING, String.class)
//add three request queries
.startKey("A").endKey("B").add() //add a request from A to B
.startKey("H").endKey("I").add() //add a request from H to I
.startKey("N").endKey("O").add() //add a request from N to O
//build the request; note the use of buildMulti() not build()
.buildMulti()
//do the POST to get the responses
.getViewResponses();
//loop the responses (in order the requests were added)
for (ViewResponse<String, String> response : responses) {
//first response is result from A to B
//second response is result from H to I
//third response is result from N to O
}
Cloudant API reference
Modifier and Type | Method and Description |
---|---|
java.util.List<ViewResponse<K,V>> |
getViewResponses()
Perform a single POST request to get the responses for the queries built into this request.
|
java.util.List<ViewResponse<K,V>> getViewResponses() throws java.io.IOException
java.io.IOException
- if there is an error communicating with the server