hi hardy,

i know and recently we had the same discussion for deltaspike.

if you like to use a ResourceBundle, you can use it in your custom MessageResolver easily.
however, in some cases a custom implementation of ResourceBundle just adds complexity you might not need.
the MessageResolver interface defines an easy contract (key + local in and stored message out).


2012/6/25 Hardy Ferentschik <hardy@hibernate.org>
Ok, I see the difference now. Your proposal goes away completely from bundles of messages and just takes a single message into consideration. Sure that works as well.
What is in your opinion the big gain of MessageResolver over ResourceBundleLocator? Obviously a resource bundle does not have to be backed by a properties file, but you could
return any custom bundle subclass you like. Are bundles not the general way i18n is approached in Java? It seems natural to "bundle" your custom validation messages per locale, or not?


On Jun 24, 2012, at 1:40 PM, Gerhard Petracek wrote:

> hi hardy,
> maybe it isn't that obvious since a ResourceBundleLocator isn't only about resource-bundles - see [1] and [2] -> i don't agree that it's a better name (since it's something slightly different).
> if we can't agree on MessageResolver, i would suggest MessageSource (similar to [3]).
> regards,
> gerhard
> [1] https://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
> [2] https://svn.apache.org/repos/asf/myfaces/extensions/cdi/tags/extcdi-1.0.5/jse-modules/message-module/api/src/main/java/org/apache/myfaces/extensions/cdi/message/api/MessageResolver.java
> [3] http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/context/MessageSource.html

beanvalidation-dev mailing list