use of org.apache.aries.cdi.container.internal.bean.ReferenceBean in project aries by apache.
the class Phase_Publish method processReferenceDependencies.
private void processReferenceDependencies(BeanManagerImpl beanManagerImpl) {
Map<ServiceReference<?>, Set<ReferenceBean>> beans = new HashMap<>();
for (ReferenceDependency referenceDependency : _bc.getReferences()) {
for (ServiceReference<?> matchingReference : referenceDependency.getMatchingReferences()) {
Set<ReferenceBean> set = beans.get(matchingReference);
if (set == null) {
set = new HashSet<>();
beans.put(matchingReference, set);
}
ReferenceBean existingBean = null;
for (ReferenceBean bean : set) {
if (bean.getBindType() == referenceDependency.getBindType() && bean.getBeanClass().equals(referenceDependency.getBeanClass()) && bean.getTypes().contains(referenceDependency.getInjectionPointType())) {
existingBean = bean;
}
}
if (existingBean != null) {
existingBean.addQualifier(referenceDependency.getReference());
existingBean.addQualifiers(referenceDependency.getInjectionPoint().getQualifiers());
} else {
ReferenceBean bean = new ReferenceBean(beanManagerImpl, _bc.getBundleContext(), referenceDependency.getInjectionPointType(), referenceDependency.getBeanClass(), referenceDependency.getBindType(), matchingReference);
bean.addQualifier(referenceDependency.getReference());
bean.addQualifiers(referenceDependency.getInjectionPoint().getQualifiers());
set.add(bean);
beanManagerImpl.addBean(bean);
}
}
}
}
Aggregations