if (providerInterface.getParameterizedType() == null) {
throw new RuntimeException("top level provider " + providerClassType.getFullyQualifiedName()
+ " must use a parameterized " + Provider.class.getName() + " interface type.");
}
final MetaType parmType = providerInterface.getParameterizedType().getTypeParameters()[0];
if (parmType instanceof MetaParameterizedType) {
providedType = (MetaClass) ((MetaParameterizedType) parmType).getRawType();
}
else {
providedType = (MetaClass) parmType;
}
injectionContext.registerInjector(new ProviderInjector(providedType, providerClassType, injectionContext));
}
else if (MC_ContextualTypeProvider.isAssignableFrom(providerClassType)) {
for (final MetaClass interfaceType : providerClassType.getInterfaces()) {
if (MC_ContextualTypeProvider.equals(interfaceType.getErased())) {
providerInterface = interfaceType;
}
}
if (providerInterface == null) {
throw new RuntimeException("top level provider " + providerClassType.getFullyQualifiedName()
+ " must directly implement " + ContextualTypeProvider.class.getName());
}
if (providerInterface.getParameterizedType() == null) {
throw new RuntimeException("top level provider " + providerClassType.getFullyQualifiedName()
+ " must use a parameterized " + ContextualTypeProvider.class.getName() + " interface type.");
}
final MetaType parmType = providerInterface.getParameterizedType().getTypeParameters()[0];
if (parmType instanceof MetaParameterizedType) {
providedType = (MetaClass) ((MetaParameterizedType) parmType).getRawType();
}
else {
providedType = (MetaClass) parmType;