Class AggregateResourceBundleLocator
java.lang.Object
org.hibernate.validator.resourceloading.DelegatingResourceBundleLocator
org.hibernate.validator.resourceloading.AggregateResourceBundleLocator
- All Implemented Interfaces:
ResourceBundleLocator
A
ResourceBundleLocator implementation that provides access
to multiple source ResourceBundles by merging them into one
aggregated bundle.- Author:
- Gunnar Morling
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.This class should not have been part of the public API and will be removed at a later stage. -
Constructor Summary
ConstructorsConstructorDescriptionAggregateResourceBundleLocator(List<String> bundleNames) Creates a locator that delivers a resource bundle merged from the given list of source bundles.AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize) Creates a locator that delivers a resource bundle merged from the given list of source bundles.AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize, ResourceBundleLocator delegate) Creates a locator that delivers a resource bundle merged from the given list of source bundles.AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize, ResourceBundleLocator delegate, ClassLoader classLoader) Creates a locator that delivers a resource bundle merged from the given list of source bundles.AggregateResourceBundleLocator(List<String> bundleNames, ResourceBundleLocator delegate) Creates a locator that delivers a resource bundle merged from the given list of source bundles.AggregateResourceBundleLocator(List<String> bundleNames, ResourceBundleLocator delegate, ClassLoader classLoader) Creates a locator that delivers a resource bundle merged from the given list of source bundles. -
Method Summary
Modifier and TypeMethodDescriptiongetResourceBundle(Locale locale) Returns a resource bundle for the given locale.
-
Constructor Details
-
AggregateResourceBundleLocator
Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all entries from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.
-
AggregateResourceBundleLocator
Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all keys from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.delegate- A delegate resource bundle locator. The bundle returned by this locator will be added to the aggregate bundle after all source bundles.
-
AggregateResourceBundleLocator
public AggregateResourceBundleLocator(List<String> bundleNames, ResourceBundleLocator delegate, ClassLoader classLoader) Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all keys from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.delegate- A delegate resource bundle locator. The bundle returned by this locator will be added to the aggregate bundle after all source bundles.classLoader- The classloader to use for loading the bundle.- Since:
- 5.2
-
AggregateResourceBundleLocator
@Incubating public AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize) Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all entries from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.preloadResourceBundles- if resource bundles should be initialized when initializing the locatorlocalesToInitialize- The set of locales to initialize at bootstrap- Since:
- 6.1.1
-
AggregateResourceBundleLocator
@Incubating public AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize, ResourceBundleLocator delegate) Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all keys from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.preloadResourceBundles- if resource bundles should be initialized when initializing the locatorlocalesToInitialize- The set of locales to initialize at bootstrapdelegate- A delegate resource bundle locator. The bundle returned by this locator will be added to the aggregate bundle after all source bundles.- Since:
- 6.1.1
-
AggregateResourceBundleLocator
@Incubating public AggregateResourceBundleLocator(List<String> bundleNames, boolean preloadResourceBundles, Set<Locale> localesToInitialize, ResourceBundleLocator delegate, ClassLoader classLoader) Creates a locator that delivers a resource bundle merged from the given list of source bundles.- Parameters:
bundleNames- A list with source bundle names. The returned bundle will contain all keys from all source bundles. In case a key occurs in multiple source bundles, the value will be taken from the first bundle containing the key.preloadResourceBundles- if resource bundles should be initialized when initializing the locatorlocalesToInitialize- The set of locales to initialize at bootstrapdelegate- A delegate resource bundle locator. The bundle returned by this locator will be added to the aggregate bundle after all source bundles.classLoader- The classloader to use for loading the bundle.- Since:
- 6.1.1
-
-
Method Details
-
getResourceBundle
Description copied from interface:ResourceBundleLocatorReturns a resource bundle for the given locale.- Specified by:
getResourceBundlein interfaceResourceBundleLocator- Overrides:
getResourceBundlein classDelegatingResourceBundleLocator- Parameters:
locale- A locale, for which a resource bundle shall be retrieved. Must not be null.- Returns:
- A resource bundle for the given locale. May be null, if no such bundle exists.
-