com.manywho.sdk.utils.ValidationUtils Maven / Gradle / Ivy
package com.manywho.sdk.utils;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;
public class ValidationUtils {
public static void validate(Object entity) {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set> constraintViolations = validator.validate(entity);
if (!constraintViolations.isEmpty()) {
throw new ConstraintViolationException(constraintViolations);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy