ServiceRegistryEntry entry = event.getServiceRegistryEntry();
handleReferenceAdded(entry);
}
void handleReferenceAdded(ServiceRegistryEntry entry) {
ServiceReferenceFilter filter = serviceActivityNotifiable.getServiceReferenceFilter();
boolean isStatic = entry.getServiceBeanReference().isStatic();
if (!isStatic) {
boolean allowNonStaticReferences = serviceActivityNotifiable.getAllowNonStaticReferences();
if (!allowNonStaticReferences) {
if (logger.isDebugEnabled()) {
logger.debug("Service entry " + entry + " filtered out as bean reference is static, but target " +
ObjectUtils.identityToString(serviceActivityNotifiable) +
"does not support non-static reference");
}
return;
}
}
final boolean typeMatches;
Class<?>[] exportTypes = serviceActivityNotifiable.getExportTypes();
if (!ArrayUtils.isNullOrEmpty(exportTypes)) {
//do check against export types in registry
typeMatches = getServiceRegistry().isPresentInExportTypes(entry, exportTypes);
} else {
//do check against actual implemented types
typeMatches = matchesTypes(serviceActivityNotifiable, entry);
}
if (typeMatches && filter.matches(entry)) {
serviceActivityNotifiable.add(entry);
}
}