[bv-dev] MessageResolver vs ResourceBundleLocator

Gerhard Petracek gerhard.petracek at gmail.com
Sat Jun 30 07:46:20 EDT 2012


hi hardy,

thx for moving it to an own thread!

a copy of my last answer:

...
it's just about:
 - an interface which directly allows simple but still flexible custom
implementations of (custom) message-sources (including a simple delegation
to a ResourceBundle) - see [1].
vs.
 - an interface which is restricted to ResourceBundle. -> if it isn't
possible to use ListResourceBundle or PropertyResourceBundle, users have to
implement #getKeys which might not be possible (/ that easy) for some
advanced use-cases.

the rest is more or less the same - if the MessageInterpolator receives a
key, it uses the new interface for the lookup (if there is no custom
implementation of the new interface or no result for the given key, the
existing default bundle (ValidationMessages) is used as a fallback).

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


2012/6/26 Hardy Ferentschik <hardy at hibernate.org>

>
> On Jun 26, 2012, at 8:21 AM, Gunnar Morling wrote:
>
> > I thin I've not yet totally understood what you have in mind.
>
> AFAIU Gerhard proposes a more general interface which is independent from
> ResourceBundles. Underneath you still can use them, in fact you would have
> to for
> ValidationMessages.properties. We would have to to define the
> MessageResolver interface and then also define that the default
> implementation of this interface
> resolves against ValidationMessages.properties. Even with the
> ResourceBundleLocator interface you need to somehow specify that a default
> implementation exists
> which uses ValidationMessages.properties. Is this what you have in mind
> Gerhard?
>
> > Maybe you could create a proposal for BVAL-217 describing things more in
> detail (interaction between resolver and interpolator, integration with BV
> 1.0 interpolators etc.)?
>
> +1 That would be the best.
>
>
> > I also think using resource bundles is not totally optional as there is
> the ValidationMessages bundle.
>
> Right. For that reason using ResourceBundleLocator still feels a little
> more "natural" to me.
>
> --Hardy
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20120630/31a41c3f/attachment.html 


More information about the beanvalidation-dev mailing list