com.softicar.platform.common.core.constant.container.validator.result.ConstantContainerValidatorResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.constant.container.validator.result;
import com.softicar.platform.common.core.constant.container.validator.error.IConstantContainerValidationError;
import com.softicar.platform.common.core.java.code.validation.JavaCodeValidationException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
public class ConstantContainerValidatorResult {
private final Collection> errors;
public ConstantContainerValidatorResult() {
this.errors = new ArrayList<>();
}
public void addError(IConstantContainerValidationError error) {
errors.add(error);
}
public Collection> getErrors() {
return errors;
}
public void throwExceptionIfNotEmpty() {
if (!errors.isEmpty()) {
throw new JavaCodeValidationException(//
"Validation of container class(es) failed:\n\t%s",
errors//
.stream()
.map(IConstantContainerValidationError::getMessage)
.collect(Collectors.joining("\n\t")));
}
}
}