Class AbstractMessageInterpolator
java.lang.Object
org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator
- All Implemented Interfaces:
MessageInterpolator
- Direct Known Subclasses:
ParameterMessageInterpolator
,ResourceBundleMessageInterpolator
Resource bundle backed message interpolator.
- Since:
- 5.2
- Author:
- Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Adam Stawicki, Marko Bekhta, Guillaume Smet
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.validation.MessageInterpolator
MessageInterpolator.Context
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageInterpolator
using the default resource bundle locators.AbstractMessageInterpolator
(Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
using the default resource bundle locators.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator) MessageInterpolator
taking a resource bundle locator.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator, Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
taking a resource bundle locator.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator) MessageInterpolator
taking two resource bundle locators.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, boolean cacheMessages) MessageInterpolator
taking two resource bundle locators.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, Set<Locale> localesToInitialize, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
taking two resource bundle locators.AbstractMessageInterpolator
(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles, boolean cacheMessages) MessageInterpolator
taking two resource bundle locators. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
interpolate
(MessageInterpolator.Context context, Locale locale, String term) interpolate
(String message, MessageInterpolator.Context context) interpolate
(String message, MessageInterpolator.Context context, Locale locale)
-
Field Details
-
DEFAULT_VALIDATION_MESSAGES
The name of the default message bundle.- See Also:
-
USER_VALIDATION_MESSAGES
The name of the user-provided message bundle as defined in the specification.- See Also:
-
CONTRIBUTOR_VALIDATION_MESSAGES
Default name of the message bundle defined by a constraint definition contributor.- Since:
- 5.2
- See Also:
-
-
Constructor Details
-
AbstractMessageInterpolator
public AbstractMessageInterpolator()MessageInterpolator
using the default resource bundle locators. -
AbstractMessageInterpolator
MessageInterpolator
taking a resource bundle locator.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundle
-
AbstractMessageInterpolator
public AbstractMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator) MessageInterpolator
taking two resource bundle locators.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundlecontributorResourceBundleLocator
-ResourceBundleLocator
used to load resource bundle of constraint contributor- Since:
- 5.2
-
AbstractMessageInterpolator
public AbstractMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, boolean cacheMessages) MessageInterpolator
taking two resource bundle locators.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundlecontributorResourceBundleLocator
-ResourceBundleLocator
used to load resource bundle of constraint contributorcacheMessages
- Whether resolved messages should be cached or not.- Since:
- 5.2
-
AbstractMessageInterpolator
@Incubating public AbstractMessageInterpolator(Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
using the default resource bundle locators.- Parameters:
locales
- the set of locales to initialize at bootstrapdefaultLocale
- the default localelocaleResolver
- the locale resolverpreloadResourceBundles
- if the resource bundled should be initialized at initialization time, this is useful in the case of aPredefinedScopeValidatorFactoryImpl
- Since:
- 6.1.1
-
AbstractMessageInterpolator
@Incubating public AbstractMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
taking a resource bundle locator.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundlelocales
- the set of locales to initialize at bootstrapdefaultLocale
- the default localelocaleResolver
- the locale resolverpreloadResourceBundles
- if the resource bundled should be initialized at initialization time, this is useful in the case of aPredefinedScopeValidatorFactoryImpl
- Since:
- 6.1.1
-
AbstractMessageInterpolator
@Incubating public AbstractMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, Set<Locale> localesToInitialize, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles) MessageInterpolator
taking two resource bundle locators.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundlecontributorResourceBundleLocator
-ResourceBundleLocator
used to load resource bundle of constraint contributorlocalesToInitialize
- the set of locales to initialize at bootstrapdefaultLocale
- the default localelocaleResolver
- the locale resolverpreloadResourceBundles
- if the resource bundled should be initialized at initialization time, this is useful in the case of aPredefinedScopeValidatorFactoryImpl
- Since:
- 6.1.1
-
AbstractMessageInterpolator
@Incubating public AbstractMessageInterpolator(ResourceBundleLocator userResourceBundleLocator, ResourceBundleLocator contributorResourceBundleLocator, Set<Locale> locales, Locale defaultLocale, LocaleResolver localeResolver, boolean preloadResourceBundles, boolean cacheMessages) MessageInterpolator
taking two resource bundle locators.- Parameters:
userResourceBundleLocator
-ResourceBundleLocator
used to load user provided resource bundlecontributorResourceBundleLocator
-ResourceBundleLocator
used to load resource bundle of constraint contributorlocales
- the set of locales to initialize at bootstrapdefaultLocale
- the default localecacheMessages
- whether resolved messages should be cached or notlocaleResolver
- the locale resolverpreloadResourceBundles
- if the resource bundled should be initialized at initialization time, this is useful in the case of aPredefinedScopeValidatorFactoryImpl
- Since:
- 6.1.1
-
-
Method Details
-
interpolate
- Specified by:
interpolate
in interfaceMessageInterpolator
-
interpolate
- Specified by:
interpolate
in interfaceMessageInterpolator
-
interpolate
protected abstract String interpolate(MessageInterpolator.Context context, Locale locale, String term)
-