org.appng.api.support.validation

## Class LocalizedMessageInterpolator

- java.lang.Object
- - org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator
  - - org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator
    - - org.appng.api.support.validation.LocalizedMessageInterpolator

- All Implemented Interfaces:
    javax.validation.MessageInterpolator

      public class LocalizedMessageInterpolator
      extends org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator

  A `MessageInterpolator` that is aware of a given `Locale` instead of using the default one. Additionally, it uses an `Application`'s default `MessageSource` to retrieve validation messages.
  Author:
    Matthias Müller

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface javax.validation.MessageInterpolator

      `javax.validation.MessageInterpolator.Context`

  - ### Field Summary

    - ### Fields inherited from class org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator

      `CONTRIBUTOR_VALIDATION_MESSAGES, USER_VALIDATION_MESSAGES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalizedMessageInterpolator(Locale locale, org.springframework.context.MessageSource messageSource)` Creates a new `LocalizedMessageInterpolator` using the given `Locale` .

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `interpolate(String messageTemplate, javax.validation.MessageInterpolator.Context context)`

    - ### Methods inherited from class org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator

      `interpolate`

    - ### Methods inherited from class org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator

      `interpolate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalizedMessageInterpolator

          public LocalizedMessageInterpolator(Locale locale,
                                              org.springframework.context.MessageSource messageSource)

      Creates a new `LocalizedMessageInterpolator` using the given `Locale` .
      Parameters:
        `locale` - The `Locale` to use.
        `messageSource` - An additional `MessageSource` to use. If this is an instance of `AbstractResourceBasedMessageSource`, `AbstractResourceBasedMessageSource.getBasenameSet()` is being used to create a new `ResourceBundleMessageSource` with these base names. This is necessary because a the `messageSource` might use `MessageSourceSupport.setAlwaysUseMessageFormat(boolean)`, which can't properly be handled by `MessageInterpolator`.

  - ### Method Detail

    - #### interpolate

          public String interpolate(String messageTemplate,
                                    javax.validation.MessageInterpolator.Context context)

      Specified by:
        `interpolate` in interface `javax.validation.MessageInterpolator`
      Overrides:
        `interpolate` in class `org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.