public class ViewRequestBuilder
extends java.lang.Object
The database, design document and view are specified when this class is instantiated.
A view request builder instance should be obtained from a call to
Database.getViewRequestBuilder(String, String)
.
Constructor and Description |
---|
ViewRequestBuilder(CloudantClient client,
Database database,
java.lang.String designDoc,
java.lang.String viewName)
Create a new ViewRequestBuilder for the specified database, design document and view name.
|
Modifier and Type | Method and Description |
---|---|
<K,V> MultipleRequestBuilder<K,V> |
newMultipleRequest(Key.Type<K> keyType,
java.lang.Class<V> valueType)
Create a new builder for multiple unpaginated requests on the view.
|
<K,V> PaginatedRequestBuilder<K,V> |
newPaginatedRequest(Key.Type<K> keyType,
java.lang.Class<V> valueType)
Create a new builder for a paginated request on the view.
|
<K,V> UnpaginatedRequestBuilder<K,V> |
newRequest(Key.Type<K> keyType,
java.lang.Class<V> valueType)
Create a new builder for an unpaginated request on the view.
|
public ViewRequestBuilder(CloudantClient client, Database database, java.lang.String designDoc, java.lang.String viewName)
Create a new ViewRequestBuilder for the specified database, design document and view name.
Rather than calling this constructor directly a view request builder instance should be
obtained from a call to Database.getViewRequestBuilder(String, String)
.
client
- the cloudant clientdatabase
- the databasedesignDoc
- the design doc containing the view (optionally prefixed with "_design/")viewName
- the view to build a query request forpublic <K,V> UnpaginatedRequestBuilder<K,V> newRequest(Key.Type<K> keyType, java.lang.Class<V> valueType)
Note that the maximum number of rows returnable in an unpaginated request is
Integer.MAX_VALUE
. If you need to return more results than this then use
newPaginatedRequest(Key.Type, Class)
to spread the rows across
multiple pages.
K
- type of key emitted by the viewV
- type of value emitted by the viewkeyType
- Key.Type
of the key emitted by the
viewvalueType
- class of the type of value emitted by the viewUnpaginatedRequestBuilder
for the database view specified by this
ViewRequestBuilderpublic <K,V> PaginatedRequestBuilder<K,V> newPaginatedRequest(Key.Type<K> keyType, java.lang.Class<V> valueType)
Defaults to 20 rows per page if not specified by
SettableViewParameters.Paginated.rowsPerPage(int)
K
- type of key emitted by the viewV
- type of value emitted by the viewkeyType
- Key.Type
of the key emitted by the
viewvalueType
- class of the type of value emitted by the viewPaginatedRequestBuilder
for the database view specified by this
ViewRequestBuilderpublic <K,V> MultipleRequestBuilder<K,V> newMultipleRequest(Key.Type<K> keyType, java.lang.Class<V> valueType)
K
- type of key emitted by the viewV
- type of value emitted by the viewkeyType
- Key.Type
of the key emitted by the
viewvalueType
- class of the type of value emitted by the viewMultipleRequestBuilder
for the database view specified by this
ViewRequestBuilder