@Override
public boolean handle(final InjectableInstance instance,
final Annotation annotation,
final IOCProcessingContext context) {
final List<Injector> injectors = new ArrayList<Injector>(injectionContext.getInjectors(instance.getType()));
final Injector injector;
final Iterator<Injector> injectorIterator = injectors.iterator();
boolean removed = false;
while (injectorIterator.hasNext()) {
if (!injectorIterator.next().isEnabled()) {
injectorIterator.remove();
removed = true;
}
}
if (injectors.isEmpty() && removed) {
return true;
}
if (injectors.size() == 1) {
injector = injectors.get(0);
}
else {
injector = new TypeInjector(instance.getType(), injectionContext);
}
if (injector.isEnabled() && injector instanceof TypeInjector) {
injector.getBeanInstance(instance);
}
return true;
}
});
break;
case SingletonBean:
registerHandler(entry.getValue(), new JSR330AnnotationHandler() {
@Override
public boolean handle(final InjectableInstance instance,
final Annotation annotation,
final IOCProcessingContext context) {
final Injector injector = injectionContext.getInjector(instance.getType());
if (injector.isEnabled()) {
injector.getBeanInstance(instance);
}
return true;
}
});
break;