1 package org.apache.ojb.broker.core.proxy; 2 3 17 18 import java.util.Collection ; 19 import java.util.List ; 20 import java.util.ListIterator ; 21 22 import org.apache.ojb.broker.PBKey; 23 import org.apache.ojb.broker.PersistenceBrokerException; 24 import org.apache.ojb.broker.query.Query; 25 import org.apache.ojb.broker.util.collections.RemovalAwareCollection; 26 27 34 public class ListProxyDefaultImpl extends CollectionProxyDefaultImpl implements List 35 { 36 37 42 public ListProxyDefaultImpl(PBKey aKey, Query aQuery) 43 { 44 this(aKey, RemovalAwareCollection.class, aQuery); 45 } 46 47 53 public ListProxyDefaultImpl(PBKey aKey, Class aCollClass, Query aQuery) 54 { 55 super(aKey, aCollClass, aQuery); 56 } 57 58 61 public boolean addAll(int index, Collection c) 62 { 63 return getListData().addAll(index, c); 64 } 65 66 69 public Object get(int index) 70 { 71 return getListData().get(index); 72 } 73 74 77 public Object set(int index, Object element) 78 { 79 return getListData().set(index, element); 80 } 81 82 85 public void add(int index, Object element) 86 { 87 getListData().add(index, element); 88 } 89 90 93 public Object remove(int index) 94 { 95 return getListData().remove(index); 96 } 97 98 101 public int indexOf(Object o) 102 { 103 return getListData().indexOf(o); 104 } 105 106 109 public int lastIndexOf(Object o) 110 { 111 return getListData().lastIndexOf(o); 112 } 113 114 117 public ListIterator listIterator() 118 { 119 return getListData().listIterator(); 120 } 121 122 125 public ListIterator listIterator(int index) 126 { 127 return getListData().listIterator(index); 128 } 129 130 133 public List subList(int fromIndex, int toIndex) 134 { 135 return getListData().subList(fromIndex, toIndex); 136 } 137 138 protected List getListData() 139 { 140 return (List ) super.getData(); 141 } 142 143 146 protected Collection loadData() throws PersistenceBrokerException 147 { 148 Collection result = super.loadData(); 149 150 if (result instanceof List ) 151 { 152 return result; 153 } 154 else 155 { 156 throw new PersistenceBrokerException("loaded data does not implement java.util.List"); 157 } 158 159 } 160 161 } 162 | Popular Tags |