1
10package client;
11
12import java.rmi.Remote;
13import java.rmi.RemoteException;
14import java.util.Iterator;
15import common.RemoteIterator;
16import common.RemoteAccount;
17
18public class IteratorProxy implements Iterator {
19 private RemoteIterator ri;
20 public IteratorProxy(RemoteIterator ri){
21 this.ri = ri;
22 }
23 public boolean hasNext(){
24 try {
25 return ri.hasNext();
26 } catch (RemoteException re){
27 throw new RuntimeException(re);
28 }
29 }
30 public Object next(){
31 try {
32 return new AccountProxy((RemoteAccount)ri.next());
33 } catch (RemoteException re){
34 throw new RuntimeException(re);
35 }
36 }
37 public void remove(){
38 try {
39 ri.remove();
40 } catch (RemoteException re){
41 throw new RuntimeException(re);
42 }
43 }
44}
45