[webbeans-dev] removeObserver type
David Allen
drallendc at gmail.com
Thu May 28 14:14:51 EDT 2009
On Thu, 2009-05-28 at 10:45 -0700, Gavin King wrote:
> 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().
Oops, of course. I wasn't thinking of the implementing class with
observer.getClass().
Good call. Those type parameters are superfluous. :)
>
More information about the weld-dev
mailing list