2 Replies Latest reply on Jan 14, 2014 6:59 AM by antonzimarev

    Errai CDI eventing with members in Qualifiers

    antonzimarev

      Hello,

       

      We've recently started to use Errai in the new project and found it very fascinating.

       

      But recently I've faced an issue which seems very critical to me.

      I've tried to use qualifiers annotated by @Qualifier for events with member attributes.

      It seems from the change in the Errai wiki that it should be supported now:

       

      (Edited by Mike Brock on Aug 07, 2012 11:33.

      # Qualifier attributes are not currently supported. (eg. {{@MyQualifier(foo=BAR)}} and {{@MyQualifier(foo=FOO)}} will be considered equivalent in the client). )

       

      But it's not. Could anyone please tell me if there are any limitations still using @Qualifiers?

       

      Appreciate any answer.


      Example:


      @Qualifier

      @Target({ ElementType.FIELD, ElementType.PARAMETER })

      @Retention(RetentionPolicy.RUNTIME)

      public @interface Limit {

          String value();

      }


      Producer.java:

      @Inject

      @Limit("BAR")

      private Event<String> willBeBar;


      public void produce() {

           willBeBar.fire("bar");

      }


      Consumer.java:

      public void process(@Observes @Limit("FOO") String expectFoo) { ... }

       

      And in this case method process receives "bar" event marked with @Limit("BAR"), when it shouldn't.

       

      Message was edited by: Anton Zimarev