Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1176

Incorrect statement of event observer behavior in Weld reference manual


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.0.0.Beta3
    • None
    • Documentation
    • None

      On page 86 of the Weld reference manual, the following example of event observer behavior is incorrect:

      Event qualifier types may be combined, for example:

      @Inject @Blog Event<Document> blogEvent;
      if (document.isBlog()) blogEvent.select(new AnnotationLiteral<Updated>(){}).fire(document);

      Observers must completely match the final qualified type of the event. Assume the following observers in this example:

        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) { ... }}}

      The only observer notified will be:

        public void afterBlogUpdate(@Observes @Updated @Blog Document document) { ... }

            rhn-engineering-jharting Jozef Hartinger
            rsigal@redhat.com Ronald Sigal
            0 Vote for this issue
            2 Start watching this issue