Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-137

Changing ProcessManagedBean getBean Method Signature

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • TBD
    • 1.0
    • Portable Extensions
    • 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>{}
      

      Also See https://issues.jboss.org/browse/CDITCK-215

      Attachments

        Activity

          People

            Unassigned Unassigned
            gerdogdu@managecat.com Gurkan Erdogdu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: