Injector injector;
// for multiplicities, we need to inject the reference proxy or proxies using an object factory
// which first delegates to create the proxies and then returns them in the appropriate List or array type
if (field != null) {
if (field.getType().isArray()) {
injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
} else {
injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories));
}
} else {
if (method.getParameterTypes()[0].isArray()) {
injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
} else {
injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories));
}
}
return injector;