[bv-dev] MessageResolver vs ResourceBundleLocator

Gunnar Morling gunnar at hibernate.org
Mon Jul 2 03:01:10 EDT 2012


Am 30.06.2012 13:46 schrieb "Gerhard Petracek" <gerhard.petracek at gmail.com>:
>
> 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.
>

What's that 2nd interface required for? Wouldn't it suffice to do all
lookups via the first interface and demand in the spec, that the default
implementation of that interface returns values based on the
ValidationMessages bundle?

What are the advanced use cases you have in mind?

> 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).

Sounds reasonable to me. We should expose the default implementation of the
interface during bootstrap so that custom implementations can also delegate
to it.

>
> regards,
> gerhard
>

--Gunnar

> [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
>
>
>
> _______________________________________________
> 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/20120702/297e7db0/attachment.html 


More information about the beanvalidation-dev mailing list