use of org.gradle.model.internal.type.ModelType in project gradle by gradle.
the class SpecializedMapStrategy method extract.
@Override
public <T> void extract(ModelSchemaExtractionContext<T> extractionContext) {
ModelType<T> modelType = extractionContext.getType();
if (!modelType.isClass()) {
return;
}
Class<?> contractType = modelType.getConcreteClass();
if (!contractType.isInterface()) {
return;
}
if (contractType.getGenericInterfaces().length != 1) {
return;
}
Type superType = contractType.getGenericInterfaces()[0];
if (!(superType instanceof ParameterizedType)) {
return;
}
ParameterizedType parameterizedSuperType = (ParameterizedType) superType;
if (!parameterizedSuperType.getRawType().equals(ModelMap.class)) {
return;
}
ModelType<?> elementType = ModelType.of(parameterizedSuperType.getActualTypeArguments()[0]);
Class<?> proxyImpl;
try {
proxyImpl = generatedImplementationTypes.get(modelType);
} catch (ExecutionException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
extractionContext.found(getModelSchema(extractionContext, elementType, proxyImpl));
}
Aggregations