for (MetaClass iface : type.getInterfaces()) {
if (iface.getFullyQualifiedName().equals(Provider.class.getName())) {
injectFactory.addType(type);
MetaParameterizedType pType = iface.getParameterizedType();
MetaType typeParm = pType.getTypeParameters()[0];
if (typeParm instanceof MetaParameterizedType) {
bindType = (MetaClass) ((MetaParameterizedType) typeParm).getRawType();
}
else {
bindType = (MetaClass) pType.getTypeParameters()[0];
}
boolean isContextual = false;
for (MetaField field : type.getDeclaredFields()) {
if (field.isAnnotationPresent(Inject.class)
&& field.getType().isAssignableTo(ContextualProviderContext.class)) {
isContextual = true;
break;
}
}
if (isContextual) {
injectFactory.addInjector(new ContextualProviderInjector(bindType, type, procContext));
}
else {
injectFactory.addInjector(new ProviderInjector(bindType, type, procContext));
}
break;
}
if (iface.getFullyQualifiedName().equals(ContextualTypeProvider.class.getName())) {
contextual = true;
MetaParameterizedType pType = iface.getParameterizedType();
if (pType == null) {
throw new InjectionFailure("could not determine the bind type for the IOCProvider class: "
+ type.getFullyQualifiedName());
}
// todo: check for nested type parameters
MetaType typeParm = pType.getTypeParameters()[0];
if (typeParm instanceof MetaParameterizedType) {
bindType = (MetaClass) ((MetaParameterizedType) typeParm).getRawType();
}
else {
bindType = (MetaClass) pType.getTypeParameters()[0];