1 // Copyright 2009 Google Inc. All Rights Reserved.
2 package com
.google
.appengine
.api
.datastore
;
4 import java
.util
.Collection
;
5 import java
.util
.Iterator
;
7 import java
.util
.ListIterator
;
10 * A class that simply forwards {@link QueryResult} methods to one delegate
11 * and forwards {@link List} to another.
13 * @param <T> the type of result returned by the query
16 class QueryResultListDelegator
<T
> implements QueryResultList
<T
> {
18 private final QueryResult queryResultDelegate
;
19 private final List
<T
> listDelegate
;
21 public QueryResultListDelegator(QueryResult queryResultDelegate
,
22 List
<T
> listDelegate
) {
23 this.queryResultDelegate
= queryResultDelegate
;
24 this.listDelegate
= listDelegate
;
28 public List
<Index
> getIndexList() {
29 return queryResultDelegate
.getIndexList();
33 public Cursor
getCursor() {
34 return queryResultDelegate
.getCursor();
39 return listDelegate
.size();
43 public boolean isEmpty() {
44 return listDelegate
.isEmpty();
48 public boolean contains(Object o
) {
49 return listDelegate
.contains(o
);
53 public Iterator
<T
> iterator() {
54 return listDelegate
.iterator();
58 public Object
[] toArray() {
59 return listDelegate
.toArray();
63 public <T
> T
[] toArray(T
[] ts
) {
64 return listDelegate
.toArray(ts
);
68 public boolean add(T t
) {
69 return listDelegate
.add(t
);
73 public boolean remove(Object o
) {
74 return listDelegate
.remove(o
);
78 public boolean containsAll(Collection
<?
> objects
) {
79 return listDelegate
.containsAll(objects
);
83 public boolean addAll(Collection
<?
extends T
> ts
) {
84 return listDelegate
.addAll(ts
);
88 public boolean addAll(int i
, Collection
<?
extends T
> ts
) {
89 return listDelegate
.addAll(i
, ts
);
93 public boolean removeAll(Collection
<?
> objects
) {
94 return listDelegate
.removeAll(objects
);
98 public boolean retainAll(Collection
<?
> objects
) {
99 return listDelegate
.retainAll(objects
);
103 public void clear() {
104 listDelegate
.clear();
108 public boolean equals(Object o
) {
109 return listDelegate
.equals(o
);
113 public int hashCode() {
114 return listDelegate
.hashCode();
118 public T
get(int i
) {
119 return listDelegate
.get(i
);
123 public T
set(int i
, T t
) {
124 return listDelegate
.set(i
, t
);
128 public void add(int i
, T t
) {
129 listDelegate
.add(i
, t
);
133 public T
remove(int i
) {
134 return listDelegate
.remove(i
);
138 public int indexOf(Object o
) {
139 return listDelegate
.indexOf(o
);
143 public int lastIndexOf(Object o
) {
144 return listDelegate
.lastIndexOf(o
);
148 public ListIterator
<T
> listIterator() {
149 return listDelegate
.listIterator();
153 public ListIterator
<T
> listIterator(int i
) {
154 return listDelegate
.listIterator(i
);
158 public List
<T
> subList(int i
, int i1
) {
159 return listDelegate
.subList(i
, i1
);
163 public String
toString() {
164 return listDelegate
.toString();