final class I18nPoolFactory extends Object
I18nPool
instances. This class provides a single factory method, see
getInstance(boolean)
, that creates the actual instances. Support for multiple locale can be missing in which case
this factory creates a simplified, optimized I18N pool instance. In this case locale is not used and all implemented methods
silently ignore locale
argument, if provided.
I18nPool<Template> pool = I18nPoolFactory.getInstance(false); // I18N pool without multiple locale support pool.put("index.htm", new Template("index"), Locale.getDefault()); // locale is silently ignored
For I18N pool with multiple locale support returned instance is actually a map of maps. Outer map uses locale language tag
for key while inner map uses object name. For instances with multiple locale support, locale
argument is
mandatory and all implemented methods throw illegal arguments exception if locale
is missing.
I18nPool<Template> pool = I18nPoolFactory.getInstance(true); // I18N pool with multiple locale support pool.put("index.htm", new Template("index")); // missing locale rise illegal argument exception
Modifier and Type | Class and Description |
---|---|
private static class |
I18nPoolFactory.LocalePool<T>
Locale sensitive I18N pool implementation.
|
private static class |
I18nPoolFactory.SimplePool<T>
I18N pool implementation optimized for repositories without multiple locale.
|
Constructor and Description |
---|
I18nPoolFactory() |
Modifier and Type | Method and Description |
---|---|
static <T> I18nPool<T> |
getInstance(boolean multiLocale)
Create new I18N pool instance.
|
public static <T> I18nPool<T> getInstance(boolean multiLocale)
locale
parameter is provided, it is silently ignored, see
I18nPool
interface.
For I18N pool with multiple locale support returned instance is actually a map of maps. Outer map uses locale language tag for key while inner map uses object name.
T
- instance type.multiLocale
- flag for multiple locale support.Copyright © 2019. All rights reserved.