use of jakarta.enterprise.inject.spi.configurator.ObserverMethodConfigurator in project core by weld.
the class ObserverMethodConfiguratorImpl method read.
@Override
public ObserverMethodConfigurator<T> read(AnnotatedMethod<?> method) {
checkArgumentNotNull(method);
Set<AnnotatedParameter<?>> eventParameters = method.getParameters().stream().filter((p) -> p.isAnnotationPresent(Observes.class) || p.isAnnotationPresent(ObservesAsync.class)).collect(Collectors.toSet());
checkEventParams(eventParameters, method.getJavaMember());
AnnotatedParameter<?> eventParameter = eventParameters.iterator().next();
Observes observesAnnotation = eventParameter.getAnnotation(Observes.class);
if (observesAnnotation != null) {
reception(observesAnnotation.notifyObserver());
transactionPhase(observesAnnotation.during());
async(false);
} else {
reception(eventParameter.getAnnotation(ObservesAsync.class).notifyObserver());
async(true);
}
Priority priority = method.getAnnotation(Priority.class);
if (priority != null) {
priority(priority.value());
}
beanClass(eventParameter.getDeclaringCallable().getDeclaringType().getJavaClass());
observedType(eventParameter.getBaseType());
qualifiers(Configurators.getQualifiers(eventParameter));
return this;
}
Aggregations