package cn.superdesk.uniorder.common.excel.validate;

import javax.validation.Validation;
import javax.validation.Validator;

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/8/26 下午4:00
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/8/26 下午4:00
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public class HibernateValidator {

	private static Validator validatorModeFailFastTrue = Validation.byProvider(org.hibernate.validator.HibernateValidator.class)
			.configure()
//			.failFast(true)
			.addProperty("hibernate.validator.fail_fast", "true")
			.buildValidatorFactory().getValidator();

	private static Validator validatorModeFailFastFalse = Validation.byProvider(org.hibernate.validator.HibernateValidator.class)
			.configure()
//			.failFast(false)
			.addProperty("hibernate.validator.fail_fast", "false")
			.buildValidatorFactory().getValidator();

	private HibernateValidator() {

	}

	public static Validator getValidatorModeFailFastTrue() {
		return validatorModeFailFastTrue;
	}

	public static Validator getValidatorModeFailFastFalse() {
		return validatorModeFailFastFalse;
	}

}
