final InjectableInstance instance,
final Annotation annotation,
final IOCProcessingContext context) {
final MetaClass injectedType = instance.getElementTypeOrMethodReturnType();
final MetaClassMember producerMember;
control.masqueradeAs(injectedType);
switch (instance.getTaskType()) {
case PrivateMethod:
case Method:
producerMember = instance.getMethod();
for (final MetaParameter parm : instance.getMethod().getParameters()) {
control.notifyDependency(injectedType);
final Set<MetaClass> classSet = fillInInterface(parm.getType());
control.notifyDependency(parm.getType());
control.notifyDependencies(classSet);
if (!producerMember.isStatic()) {
final GraphBuilder graphBuilder = injectionContext.getGraphBuilder();
graphBuilder.addDependency(producerMember.getDeclaringClass(), Dependency.on(parm.getType()));
for (MetaClass metaClass : classSet) {
graphBuilder.addDependency(producerMember.getDeclaringClass(), Dependency.on(metaClass));
}
}
}
break;
case PrivateField:
case Field:
producerMember = instance.getField();
break;
default:
throw new RuntimeException("illegal producer type");
}
final ProducerInjector producerInjector
= new ProducerInjector(
injectionContext,
injectedType,
producerMember,
instance.getQualifyingMetadata(),
instance);
injectionContext.registerInjector(producerInjector);
if (!producerMember.isStatic()) {
// if this is a static producer, it does not have a dependency on its parent bean
injectionContext.getGraphBuilder()
.addDependency(injectedType, Dependency.on(instance.getEnclosingType()));
}
}