-
1. Re: all Event are fired for qualified instance
swd847 Sep 1, 2010 11:44 PM (in response to nimo22)This is the correct behavior, observer methods without qualifiers get notified for every event of that type. You probably want an @Write qualifier as well.
-
2. Re: all Event are fired for qualified instance
nimo22 Sep 2, 2010 2:39 AM (in response to nimo22)Is the correct behaviour reasonable?
I told the event-producer exactly which events to be called:
bookEvent.select(new AnnotationLiteral<Read>(){}).fire(book);
I have narrowed (limited) the event consumer of the type
Read
, hence only event-consumer which observes the instances of type Read should be called.I do not say:
bookEvent.fire(book);
I also narrowed the type Book by injection:
@Inject @Read Event<Book> bookEvent;
I do not say:
@Inject Event<Book> bookEvent;
Or do I think wrong? Should I imagine it like this:
class Book extends Paper {..}
so book is a paper and when book is called, paper is also called?
So
@Inject @Book Event<Paper> bookEvent;
with producer
bookEvent.select(new AnnotationLiteral<Book>(){}).fire(book);
calls all events of instances of books which are types of book and inheritly paper.
-
3. Re: all Event are fired for qualified instance
pmuir Sep 6, 2010 5:58 AM (in response to nimo22)
This is the correct behavior, observer methods without qualifiers get notified for every event of that type. You probably want an @Write qualifier as well.That's not quite right - an observer method must have all the event qualifiers. There was a bug in Weld that caused this to not work right - can you test with Weld 1.1.0.Beta1 please?