[webbeans-dev] removeObserver type

Gavin King gavin.king at gmail.com
Thu May 28 13:45:15 EDT 2009


On Thu, May 28, 2009 at 10:37 AM, David Allen <drallendc at gmail.com> wrote:
> On Thu, 2009-05-28 at 10:18 -0700, Gavin King wrote:
>> On Thu, May 28, 2009 at 2:14 AM, David Allen <drallendc at gmail.com> wrote:
>>
>> > So where do we get T now that the signature has changed to not include
>> > it?
>>
>> do Observer.getClass().
>
> That would be the class Observer.  But how do we know what the type of
> the event is?  In other words, it would have been the actual type used
> with Observer<T> instead of the parameter T.  However, due to erasure,
> that information will not be available inside the addObserver() method.

observer.getClass().getGenericInterfaces()

iterate to find observer, cast to ParameterizedType, call
getActualTypeArguments().

-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org




More information about the weld-dev mailing list