Search in sources :

Example 1 with ErrorModelBuilder

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;
    }
}
Also used : ErrorModelBuilder(org.mule.runtime.api.meta.model.error.ErrorModelBuilder) ErrorModel(org.mule.runtime.api.meta.model.error.ErrorModel)

Aggregations

ErrorModel (org.mule.runtime.api.meta.model.error.ErrorModel)1 ErrorModelBuilder (org.mule.runtime.api.meta.model.error.ErrorModelBuilder)1