use of org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator in project JessMA by ldcsaa.
the class HibernateBeanValidator method tryCreateValidator.
private Validator tryCreateValidator(final String bundle, final Locale locale, ValidatorKey key) {
HibernateValidatorConfiguration configure = Validation.byProvider(HibernateValidator.class).configure();
configure.messageInterpolator(new ResourceBundleMessageInterpolator(new PlatformResourceBundleLocator(bundle)) {
@Override
public String interpolate(String message, Context context) {
return super.interpolate(message, context, locale);
}
});
ValidatorFactory vf = configure.buildValidatorFactory();
Validator validator = vf.getValidator();
GeneralHelper.syncTryPut(validatorMap, key, validator);
return validatorMap.get(key);
}
Aggregations