io.rocketbase.commons.converter.ValidationConverter Maven / Gradle / Ivy
package io.rocketbase.commons.converter;
import io.rocketbase.commons.dto.validation.ValidationResponse;
import io.rocketbase.commons.exception.ValidationErrorCode;
import java.util.HashMap;
import java.util.Set;
public class ValidationConverter {
public static > ValidationResponse convert(Set> errors) {
ValidationResponse response = new ValidationResponse<>(errors != null && errors.isEmpty(), new HashMap<>());
if (errors != null) {
for (ValidationErrorCode c : errors) {
response.getErrorCodes().put(c.getCode(), c.getMessage());
}
}
return response;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy