All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.constant.container.validator.result.ConstantContainerValidatorResult Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
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")));
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy