[cdi-dev] ProcessSessionBean type declaration
Pete Muir
pmuir at redhat.com
Tue Jul 10 17:33:07 EDT 2012
On 10 Jul 2012, at 15:20, Martin Kouba wrote:
>
> Dne 3.7.2012 14:57, Pete Muir napsal(a):
>>
>> On 26 Jun 2012, at 15:21, Martin Kouba wrote:
>>
>>> Hello everyone,
>>>
>>> does anyone know why ProcessSessionBean type declaration is "ProcessSessionBean<X> extends ProcessManagedBean<Object>" and not "ProcessSessionBean<X> extends ProcessManagedBean<X>"?
>>
>> The bean types of most beans (managed beans, producers) are defined by the type of the object defining the bean.
>>
>> The bean types of a session bean are defined by it's local views, as defined by the EJB spec. These might include the defining type (no-interface view), super-interfaces of the type (when defined using the classic Foo implements Bar, Baz, with @Local on interfaces) or interfaces not in the type hierarchy (when defined using @Local on the defining type).
>>
>> ProcessManagedBean allows access to AnnotatedType<X>, where X is the bean class.
>>
>> Putting this together, we can see there is a problem as X, as the bean class may have no relationship to the bean type, in the java type hierarchy (which is clearly crazy, but anyway). For this reason, we choose to simply avoid this whole problem by forcing people to do a cast on getAnnotatedBeanClass.
>>
>> Does that make sense?
>
> Not really. AFAIK the bean class of a session bean is the implementation type - no relation to bean types (e.g. FooBean for FooBean implements FooLocal). You have to observe ProcessSessionBean<FooBean> not ProcessSessionBean<FooLocal>. So I don't think there is something wrong with AnnotatedType<X> or Bean<X>. Maybe I'm still missing something...
Ah, sorry. How about, that ProcessBean<X> allows you access to the Bean<X>, which in turn allows you to instantiate an instance. I think that is why it is blocked.
>
> BTW this declaration "ProcessSessionBean<X> extends ProcessManagedBean<Object>" prevents from observing lifecycle events like ProcessBean<FooBean> which is not very intuitive IMHO.
>
>>
>>> Also there is no comment for type parameter X.
>>
>> Bug, please raise an issue :-)
>>
>>>
>>> Thanks
>>> Martin
>>>
>>> --
>>> Martin Kouba
>>> JBoss Quality Assurance Engineer
>>> CDI TCK lead
>>> E-mail: mkouba at redhat.com
>>> Web: www.cz.redhat.com
>>> Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic
>>> _______________________________________________
>>> cdi-dev mailing list
>>> cdi-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>>
>
>
More information about the cdi-dev
mailing list