try {
Object instance = beanManager.getReference(declaringBean, declaringBeanType, creationalContext);
if (instance == null) {
return;
}
observerMethod.invoke(instance, creationalContext, new ParameterValueRedefiner() {
public Object redefineParameterValue(ParameterValue value) {
if (value.getInjectionPoint().getAnnotated().isAnnotationPresent(Observes.class)) {
return event;
} else {