use of org.jboss.weld.injection.attributes.WeldInjectionPointAttributes in project core by weld.
the class Probe method hasDeclaredObserversOrIsInjectedIntoObserver.
private boolean hasDeclaredObserversOrIsInjectedIntoObserver(Bean<?> bean, Collection<ObserverMethod<?>> observers) {
for (ObserverMethod<?> observerMethod : observers) {
if (observerMethod instanceof ObserverMethodImpl) {
ObserverMethodImpl<?, ?> observerMethodImpl = (ObserverMethodImpl<?, ?>) observerMethod;
if (bean.equals(observerMethodImpl.getDeclaringBean())) {
return true;
}
Set<WeldInjectionPointAttributes<?, ?>> injectionPoints = observerMethodImpl.getInjectionPoints();
if (!injectionPoints.isEmpty()) {
BeanManager beanManager = getBeanManager(observerMethodImpl.getDeclaringBean());
if (beanManager != null) {
for (WeldInjectionPointAttributes<?, ?> injectionPoint : injectionPoints) {
if (bean.equals(beanManager.resolve(beanManager.getBeans(injectionPoint.getType(), injectionPoint.getQualifiers().toArray(new Annotation[injectionPoint.getQualifiers().size()]))))) {
return true;
}
}
}
}
}
}
return false;
}
Aggregations