[bv-dev] MessageResolver vs ResourceBundleLocator

Gunnar Morling gunnar at hibernate.org
Tue Jul 10 16:38:54 EDT 2012


Hi Gerhard,

> - an interface which is restricted to ResourceBundle

Could you give some more details on this second interface and the
advanced use cases you have in mind?

Thanks,

--Gunnar


2012/7/2 Gunnar Morling <gunnar at hibernate.org>:
>
> 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
>>


More information about the beanvalidation-dev mailing list