[
http://opensource.atlassian.com/projects/hibernate/browse/HV-238?page=com...
]
Gunnar Morling updated HV-238:
------------------------------
Attachment: HV-238.patch
Added a patch with a solution for HV-238/HV-251.
ResourceBundleMessageInterpolator delegates the actual loading of resources to
ResourceBundleLocator implementations now. The interface looks as follows:
{code:java}
public interface ResourceBundleLocator {
ResourceBundle getResourceBundle(Locale locale);
}
{code}
The default implementation simply loads ValidationMessages. It can be retrieved from
HibernateValidatorConfiguration and be used as delegate for custom RBL implementions (e.g.
based on XML):
{code:java}
HibernateValidatorConfiguration configure =
Validation.byProvider(HibernateValidator.class).configure();
ResourceBundleLocator defaultResourceBundleLocator =
configure.getDefaultResourceBundleLocator();
ResourceBundleLocator myResourceBundleLocator =
new MyXmlResourceBundleLocator("some_xml_based_bundle.xml",
defaultResourceBundleLocator);
configure.messageInterpolator(
new ResourceBundleMessageInterpolator(myResourceBundleLocator));
{code}
Introduce a ResourceBundleLocatorStrategy interface which allows the
ResourceBundleMessageInterpolator to delegate the loading of the resource bundle
-----------------------------------------------------------------------------------------------------------------------------------------------------
Key: HV-238
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-238
Project: Hibernate Validator
Issue Type: New Feature
Components: engine
Affects Versions: 4.0.0.CR1
Reporter: Hardy Ferentschik
Assignee: Gunnar Morling
Fix For: 4.1.0-Beta-1
Attachments: HV-238.patch
Subject: Re: Bean validation dans Spring
Hi Emmanuel,
thanx for your feedback. I'm answering in English so I can cc Juergen.
So far, we have provided our own implementation of MessageInterpolator as you have
suggested. The thing is that it forces us to copy and paste a big piece of code which is
not ideal on the long term.
Juergen was suggesting a few possible minor enhancements on Hibernate Validator, that
would allow us to plug in a custom ResourceBundle:
- Either making the existing getFileBasedResourceBundle(Locale) method protected instead
of private.
- Or introducing a corresponding strategy interface that
ResourceBundleMessageInterpolator can be constructed with
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira