1 19 20 package org.apache.cayenne.access; 21 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import java.util.Iterator ; 25 import java.util.List ; 26 import java.util.ListIterator ; 27 import java.util.Map ; 28 29 35 class ListWithPrefetches implements List { 42 43 private final List list; 44 private final Map prefetchResultsByPath; 45 46 ListWithPrefetches(List mainList, Map prefetchResultsByPath) { 47 if (mainList == null) { 48 throw new IllegalArgumentException ("Main list is null"); 49 } 50 51 this.list = mainList; 52 this.prefetchResultsByPath = prefetchResultsByPath != null ? Collections 53 .unmodifiableMap(prefetchResultsByPath) : null; 54 } 55 56 Map getPrefetchResultsByPath() { 57 return prefetchResultsByPath; 58 } 59 60 public void add(int index, Object element) { 61 list.add(index, element); 62 } 63 64 public boolean add(Object o) { 65 return list.add(o); 66 } 67 68 public boolean addAll(Collection c) { 69 return list.addAll(c); 70 } 71 72 public boolean addAll(int index, Collection c) { 73 return list.addAll(index, c); 74 } 75 76 public void clear() { 77 list.clear(); 78 } 79 80 public boolean contains(Object o) { 81 return list.contains(o); 82 } 83 84 public boolean containsAll(Collection c) { 85 return list.containsAll(c); 86 } 87 88 public boolean equals(Object o) { 89 return list.equals(o); 90 } 91 92 public Object get(int index) { 93 return list.get(index); 94 } 95 96 public int hashCode() { 97 return list.hashCode(); 98 } 99 100 public int indexOf(Object o) { 101 return list.indexOf(o); 102 } 103 104 public boolean isEmpty() { 105 return list.isEmpty(); 106 } 107 108 public Iterator iterator() { 109 return list.iterator(); 110 } 111 112 public int lastIndexOf(Object o) { 113 return list.lastIndexOf(o); 114 } 115 116 public ListIterator listIterator() { 117 return list.listIterator(); 118 } 119 120 public ListIterator listIterator(int index) { 121 return list.listIterator(index); 122 } 123 124 public Object remove(int index) { 125 return list.remove(index); 126 } 127 128 public boolean remove(Object o) { 129 return list.remove(o); 130 } 131 132 public boolean removeAll(Collection c) { 133 return list.removeAll(c); 134 } 135 136 public boolean retainAll(Collection c) { 137 return list.retainAll(c); 138 } 139 140 public Object set(int index, Object element) { 141 return list.set(index, element); 142 } 143 144 public int size() { 145 return list.size(); 146 } 147 148 public List subList(int fromIndex, int toIndex) { 149 return list.subList(fromIndex, toIndex); 150 } 151 152 public Object [] toArray() { 153 return list.toArray(); 154 } 155 156 public Object [] toArray(Object [] a) { 157 return list.toArray(a); 158 } 159 } 160 | Popular Tags |