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

Incorrect statement of event observer behavior in Weld reference manual

    XMLWordPrintable

Details

    Description

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: