1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.search
;
5 import com
.google
.appengine
.api
.search
.checkers
.Preconditions
;
7 import java
.io
.Serializable
;
8 import java
.util
.Collections
;
9 import java
.util
.Iterator
;
10 import java
.util
.List
;
13 * Represents a result of executing a {@link GetRequest}. The
14 * response contains a list of T.
16 * @param <T> The type of object to be listed from an index
18 public class GetResponse
<T
> implements Iterable
<T
>, Serializable
{
19 private static final long serialVersionUID
= 7050146612334976140L;
21 private final List
<T
> results
;
24 * Creates a {@link GetResponse} by specifying a list of T.
26 * @param results a list of T returned from the index
28 protected GetResponse(List
<T
> results
) {
29 this.results
= Collections
.unmodifiableList(
30 Preconditions
.checkNotNull(results
, "results cannot be null"));
34 public Iterator
<T
> iterator() {
35 return results
.iterator();
39 * @return an unmodifiable list of T from the index
41 public List
<T
> getResults() {
46 public String
toString() {
47 return new Util
.ToStringHelper("GetResponse")
48 .addIterableField("results", results
, 0)