com.google.api.server.spi.response
Class CollectionResponse<T>
- java.lang.Object
-
- com.google.api.server.spi.response.CollectionResponse<T>
-
public class CollectionResponse<T> extends java.lang.Object
Collection response to be returned by an endpoint implementation method that wants to support pagination (and other metadata about returned collection in the future). Endpoint implementation method would do something like this to use it:public CollectionResponse<Greeting> list(@Named("pageToken") String pageToken) { List<Greeting> greetings = new ArrayList<Greeting>(); // use pageToken to fill greetings with next page of items return CollectionResponse.<Greeting>builder() .setItems(greetings) .setNextPageToken("newPageToken") .build(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
CollectionResponse.Builder<T>
Builder forCollectionResponse
.
-
Constructor Summary
Constructors Modifier Constructor and Description protected
CollectionResponse(java.util.Collection<T> items, java.lang.String nextPageToken)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static <T> CollectionResponse.Builder<T>
builder()
java.util.Collection<T>
getItems()
java.lang.String
getNextPageToken()
-
-
-
Constructor Detail
-
CollectionResponse
protected CollectionResponse(java.util.Collection<T> items, java.lang.String nextPageToken)
-
-
Method Detail
-
builder
public static <T> CollectionResponse.Builder<T> builder()
-
getNextPageToken
public java.lang.String getNextPageToken()
-
getItems
public java.util.Collection<T> getItems()
-
-