-
1. Re: Docs wrong - multiple event qualifiers?
luksa Oct 1, 2013 4:51 PM (in response to dudehook)The documentation is ok. "All" is correct. If the observed qualifiers are @A, @B and @C, the method will be notified if all of those qualifiers (and possibly any additional qualifiers) are specified when firing the event. in other words, the method will not be notified if the event is fired only with @A and @B and without @C.
-
2. Re: Docs wrong - multiple event qualifiers?
dudehook Oct 1, 2013 5:11 PM (in response to luksa)Ok, but why, then, does it say that "all observer methods will be notified"?
@Inject @Blog Event<Document> blogEvent;
...
if (document.isBlog()) blogEvent.select(new AnnotationLiteral<Updated>(){}).fire(document);public void afterBlogUpdate(@Observes @Updated @Blog Document document) { ... }
public void afterDocumentUpdate(@Observes @Updated Document document) { ... }
public void onAnyBlogEvent(@Observes @Blog Document document) { ... }
public void onAnyDocumentEvent(@Observes Document document) { ... }}}
-
3. Re: Docs wrong - multiple event qualifiers?
luksa Oct 1, 2013 5:27 PM (in response to dudehook)1 of 1 people found this helpfulTHe event is fired as @Updated @Blog Document.
@Observes @Updated @Blog Document will obviously be notified, since both of the observed qualifiers are on the fired event.
@Observes @Updated Document will also be notified, because the observed qualifier (@Updated) is on the fired event. the same is true for @Observes @Blog Document.
@Obsrves Document will also be notified.
AN observer will be invoked if the qualifiers it declares are a subset of the qualifiers on the fired event.
-
4. Re: Docs wrong - multiple event qualifiers?
dudehook Oct 2, 2013 10:33 AM (in response to luksa)Ok - got it. I guess the doc is just a little confusing where it says: "An observer method is only notified if all the observed qualifiers are specified when the event is fired."
I read that as meaning that all of the qualifiers on the event must match all of the qualifiers that are being observed. Your statement about the subset in the doc would make it clear.
Thanks for the clarification!