[JBoss JIRA] (CDI-137) Changing ProcessManagedBean getBean Method Signature
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-137?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-137:
-------------------------------------
Description:
Currently ProcessSessionBean class signature is
{code:java}
public class ProcessSessionBean<T> extends ProcessManagedBean<Object>{}
{code}
Therefore, observers work as
Example:
{code:java}
@Stateless
public class Elephant{}
public void observe(@Observes ProcessBean<Elephant>) // --> Not allowed
public void observe(@Observes ProcessSessionBean<Elephant>) // --> Allowed
{code}
Pete said that main reason of using ProcessManagedBean<Object> is that
{quote}
{{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.
{quote}
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
{code:java}
public class ProcessSessionBean<X> extends ProcessManagedBean<X>{}
{code}
Also See https://issues.jboss.org/browse/CDITCK-215
was:
Currently ProcessSessionBean class signature is
public class ProcessSessionBean<T> extends ProcessManagedBean<Object>{}
Therefore, observers work as
Example:
{code:java}
@Stateless
public class Elephant{}
public void observe(ProcessBean<Elephant>) // --> Not allowed
public void observe(ProcessSessionBean<Elephant>) // --> Allowed
{code}
Pete said that main reason of using ProcessManagedBean<Object> is that
{quote}
{{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.
{quote}
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
{code:java}
public class ProcessSessionBean<X> extends ProcessManagedBean<X>{}
{code}
Also See https://issues.jboss.org/browse/CDITCK-215
> Changing ProcessManagedBean getBean Method Signature
> ----------------------------------------------------
>
> Key: CDI-137
> URL: https://issues.jboss.org/browse/CDI-137
> Project: CDI Specification Issues
> Issue Type: Bug
> Components: Portable Extensions
> Affects Versions: 1.0
> Reporter: Gurkan Erdogdu
> Fix For: TBD
>
>
> Currently ProcessSessionBean class signature is
> {code:java}
> public class ProcessSessionBean<T> extends ProcessManagedBean<Object>{}
> {code}
> Therefore, observers work as
> Example:
> {code:java}
> @Stateless
> public class Elephant{}
> public void observe(@Observes ProcessBean<Elephant>) // --> Not allowed
> public void observe(@Observes ProcessSessionBean<Elephant>) // --> Allowed
> {code}
> Pete said that main reason of using ProcessManagedBean<Object> is that
> {quote}
> {{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.
> {quote}
> 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
> {code:java}
> public class ProcessSessionBean<X> extends ProcessManagedBean<X>{}
> {code}
> Also See https://issues.jboss.org/browse/CDITCK-215
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)