com.github.lsqlebai.utils.BeanValidUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-common Show documentation
Show all versions of server-common Show documentation
An kotlin server common jar
package com.github.lsqlebai.utils;
import com.github.lsqlebai.exception.ParameterValidationException;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;
public class BeanValidUtil {
/**
* 参数验证工具
*/
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
public static void validateObj(Object object){
Set> constraintViolations = validator.validate(object);
if (constraintViolations != null && constraintViolations.size() > 0) {
ConstraintViolation
© 2015 - 2025 Weber Informatics LLC | Privacy Policy