com.kasinf.framework.rest.web.util.ValidatorUtils Maven / Gradle / Ivy
The newest version!
package com.kasinf.framework.rest.web.util;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.util.Set;
/**
* @author lkhsh
*
* 利用Hibernate Validator进行验证的工具类
*/
public class ValidatorUtils {
public static Validator validator;
public ValidatorUtils(Validator validator) {
ValidatorUtils.validator = validator;
}
public static Set> validate(Object target) {
return validator.validate(target);
}
public static Set> validate(Object target, Class>... groups) {
return validator.validate(target, groups);
}
}