use of org.mule.runtime.api.meta.model.error.ErrorModelBuilder in project mule by mulesoft.
the class ErrorsModelFactory method toErrorModel.
/**
* @param errorTypeDefinition
* @param errorModelMap
* @return
*/
private ErrorModel toErrorModel(ErrorTypeDefinition<?> errorTypeDefinition, Map<String, ErrorModel> errorModelMap) {
if (errorModelMap.containsKey(toIdentifier(errorTypeDefinition))) {
return errorModelMap.get(toIdentifier(errorTypeDefinition));
} else {
ErrorModelBuilder builder = newError(errorTypeDefinition.getType(), getErrorNamespace(errorTypeDefinition));
builder.withParent(toErrorModel(errorTypeDefinition.getParent().orElse(ANY), errorModelMap));
ErrorModel errorModel = builder.build();
errorModelMap.put(toIdentifier(errorTypeDefinition), errorModel);
return errorModel;
}
}
Aggregations