com.github.egatlovs.variablemanager.validation.ConstraintViolationMessage Maven / Gradle / Ivy
package com.github.egatlovs.variablemanager.validation;
import javax.validation.ConstraintViolation;
import java.util.Set;
/**
* ConstraintViolationMessage
*
* ConstraintViolationMessage uses the BeanValidations ConstraintViolations to
* create a String representing each validation failure of an ExecutionEntity.
*
* @author egatlovs
*/
public class ConstraintViolationMessage {
private final Set> constraintViolations;
/**
* Constructor creating a Constraint Violation Message out of a Set of
* ConstraintViolations.
*
* @param constraintViolations - The violations occured while validating
*/
public ConstraintViolationMessage(Set> constraintViolations) {
this.constraintViolations = constraintViolations;
}
/**
* Returns a message containing each ConstraintViolation in a more readable
* representation.
*
* @return - The formatted ConstraintViolations
*/
public String getMessage() {
StringBuilder sb = new StringBuilder("Constraint Violations occured: \n");
for (ConstraintViolation
© 2015 - 2025 Weber Informatics LLC | Privacy Policy