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