Details
-
Bug
-
Resolution: Obsolete
-
Major
-
1.0
-
None
Description
Currently ProcessSessionBean class signature is
public class ProcessSessionBean<T> extends ProcessManagedBean<Object>{}
Therefore, observers work as
Example:
@Stateless public class Elephant{} public void observe(@Observes ProcessBean<Elephant>) // --> Not allowed public void observe(@Observes ProcessSessionBean<Elephant>) // --> Allowed
Pete said that main reason of using ProcessManagedBean<Object> is that
ProcessBean<X> offers a method getBean() which returns Bean<X>. Bean<X> has a method create() which returns an X. If we were to have ProcessSessionBean<X> extends ProcessManagedBean<X> then this would imply that you can create something of type, which in the case of a session bean is the bean class (which can't be created for EJBs with local or remote business interfaces). So ProcessSessionBean is correct as is.
Main reason of using the ProcessSessionBean event is to observe "Session Bean Class" registration, not the observe for the session bean local interface/s.
Moreover, other methods in the interface hierarchy of ProcessSessionBean gets <X> into the account, for example AnnotatedType<X> getAnnotatedBeanClass() returns the AnnotatedType representing the bean class.
Therefore, it is more convenient to change "ProcessManagedBean getBean" method declaration as public <T> Bean<T> getBean(); where T is the local/local view interface of the session bean.
And change the ProcessSessionBean signature as
public class ProcessSessionBean<X> extends ProcessManagedBean<X>{}