This content has been marked as final.
Show 1 reply
-
1. Re: Business Interface Pattern + Generics == EJB Spec Violat
jaikiran Jul 4, 2009 10:44 AM (in response to kurron)Consider this:
public interface AddressBeanBusinessInterface <E extends Exception> { ... public void delete( final Long key ) throws E, UnknownIdDeviation;
public interface AddressBeanRemote extends EJBObject, AddressBeanBusinessInterface<RemoteException> { // empty - see the business interface for the remote EJB methods ...
andpublic interface AnotherInterface extends AddressBeanBusinessInterface<NullPointerException> { // empty - see the business interface for the remote EJB methods
So there 2 interfaces which extend the AddressBeanBusinessInterface. One expects to throw a NullPointerException and the other a RemoteException. So what should the compiler "replace" the E in AddressBeanBusinessInterface? It doesn't. All it does is marks the method to throw an Exception (as marked by E extends Exception):public interface AddressBeanBusinessInterface <E extends Exception> { ... public void delete( final Long key ) throws Exception, UnknownIdDeviation;