@Override public GeneralValidator getContext(final Class<?> type) { final ResourceBundleLocator resourceBundleLocator = new PlatformResourceBundleLocator("messages"); final MessageInterpolator messageInterpolator = new ResourceBundleMessageInterpolator(resourceBundleLocator); final Configuration<?> config = Validation.byDefaultProvider().configure() .messageInterpolator(messageInterpolator); final BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration(); final boolean isExecutableValidationEnabled = bootstrapConfiguration.isExecutableValidationEnabled(); final Set<ExecutableType> defaultValidatedExecutableTypes = bootstrapConfiguration .getDefaultValidatedExecutableTypes(); return new GeneralValidatorImpl(validatorFactory, isExecutableValidationEnabled, defaultValidatedExecutableTypes); }
protected ResourceBundleLocator newResourceBundleLocator() { return ignoredLocale -> { // not used default locacle managed in Hibernate validator, // all messages use provided locale (e.g. request locale) // to match with other message's locale final Locale provided = messageLocaleProvider.provide(); return newHookedResourceBundle(provided); }; }
private ResourceBundleLocator buildBundleLocator(final String name) { return locale -> Messages.getResourceBundle(name, locale); }
public CustomMessageInterpolator(ResourceBundleLocator userResourceBundleLocator) { super(userResourceBundleLocator); }
public CustomMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, boolean cacheMessages) { super(userResourceBundleLocator, cacheMessages); }