| Can a bean's remote interface extend an existing interface? |
|
Absolutely! The bean's remote interface can certainly extend an existing interface. The only restriction here is that all interfaces that it extends must have all methods throw java.rmi.RemoteException.
public interface SortRemote extends Sort, javax.ejb.EJBObject {
}
public interface Sort {
Vector sort(Vector v, Compare c) throws java.rmi.RemoteException;
Vector merge(Vector a, Vector b, Compare c) throws
java.rmi.RemoteException;
}
public interface Sort extends java.rmi.Remote {
Vector sort(Vector v, Compare c) throws java.rmi.RemoteException;
Vector merge(Vector a, Vector b, Compare c) throws java.rmi.RemoteException;
}
and then SortRemote could remain:
public interface SortRemote extends Sort, javax.ejb.EJBObject {
}
This probably is close to the previous design and does a better
job of expressing the fact that Sort is actually a remote
interface (although not necessarily an EJB interface). It
was already implied that Sort was a remote interface, by
the fact that all its methods throw RemoteException, so
why not make it explicit?
|