Currently there is no way for observer methods to access the qualifiers of the fired event (i.e. to access @Nonbinding members).
Consider the following example:
@Inject @MyQualifier Event<MyObject> event; public void fireEvent(MyObject object, MyTypeValue type) { event.select(new MyTypeAnnotationLiteral(type)).fire(object); }
Currently no observer can receive the value of MyTypeValue. I suggest to introduce an interface AnnotatedEvent that extends Annotated and contains this information. It then could be injected via the InjectionPoint like this:
public void observeEvent(@Observes @MyType MyObject object, InjectionPoint ip) {
MyType annotation = ip.getAnnotated().getAnnotation(MyType.class);
MyTypeValue value = annotation.value();
...
}
- blocks
-
CDI-324 Update InjectionPoint getBean() and isTransient() methods description to reflect Event instance
- Closed
- is related to
-
CDI-20 @Observes(propagate = false) - stop event propagation after being handled by an observer
- Closed
-
CDI-36 ObserverMethod.notify() does not forward qualifiers for Event
- Closed
- relates to
-
CDI-323 Specify what happens when a bean, that has an injection point of type InjectionPoint, is created via BeanManager#getReference(...)
- Closed