[cdi-dev] Event type
Marko Lukša
marko.luksa at gmail.com
Wed Aug 29 10:21:29 EDT 2012
I have been reading the spec about events and I'm a little confused.
In "Chapter 10. Events", the spec says:
* An event comprises: - A Java object—the/event object/
* The event object acts as a payload
* An observer method will be notified of an event if the *event object
is assignable to the observed event type
*
I understand this to mean that the actual payload is what's important
when resolving observer methods. Yet, this is not true when firing
events through the Event bean. When firing events through the Event
bean, observers are resolved according to the type parameter of the
injected Event bean (or the type passed to event.select()) and not the
actual type of payload supplied to event.fire(payload) (see
https://issues.jboss.org/browse/WELD-672).
In WELD, the actual type of the payload is only important when firing
events through BeanManager.fireEvent(), which is not even mentioned in
"10.3. Firing events". From 10.3, I would expect that the usual way of
firing events is through the Event bean, and firing events through the
BeanManager is the low-level way of doing it.
I have a few more questions, but they are all inter-dependent, so it's
probably better if you help me resolve this one first, and then I'll
move on to the rest.
Marko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20120829/feefa609/attachment.html
More information about the cdi-dev
mailing list