@ThreadSafe @Singleton public final class LocaleCache extends Object
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsLocale(String sLanguage)
Check if the passed language is in the cache.
|
boolean |
containsLocale(String sLanguage,
String sCountry)
Check if the passed language is in the cache.
|
boolean |
containsLocale(String sLanguage,
String sCountry,
String sVariant)
Check if the passed language is in the cache.
|
ICommonsSet<Locale> |
getAllLanguages()
Get all contained locales that consist only of a non-empty language.
|
ICommonsList<Locale> |
getAllLocales()
Get all contained locales except the locales "all" and "independent"
|
static LocaleCache |
getInstance() |
Locale |
getLocale(String sLanguage)
Get the
Locale object matching the given language. |
Locale |
getLocale(String sLanguage,
String sCountry)
Get the
Locale object matching the given language and country. |
Locale |
getLocale(String sLanguage,
String sCountry,
String sVariant)
Get the
Locale object matching the given locale string |
static boolean |
isInstantiated() |
void |
reinitialize()
Reset the cache to the initial state.
|
public static boolean isInstantiated()
@Nonnull public static LocaleCache getInstance()
@Nullable public Locale getLocale(@Nullable String sLanguage)
Locale object matching the given language.sLanguage - The language to use. May be null or empty.null if the passed language string is
null or empty@Nullable public Locale getLocale(@Nullable String sLanguage, @Nullable String sCountry)
Locale object matching the given language and country.sLanguage - The language to use. May be null or empty.sCountry - The country to use. May be null.null if the passed language string is
null or empty@Nullable public Locale getLocale(@Nullable String sLanguage, @Nullable String sCountry, @Nullable String sVariant)
Locale object matching the given locale stringsLanguage - The language to use. May be null or empty.sCountry - Optional country to use. May be null.sVariant - Optional variant. May be null.null if all the passed parameters are
null or empty@Nonnull @ReturnsMutableCopy public ICommonsList<Locale> getAllLocales()
@Nonnull @ReturnsMutableCopy public ICommonsSet<Locale> getAllLanguages()
public boolean containsLocale(@Nullable String sLanguage)
sLanguage - The language to check.true if it is in the cache, false
otherwise.public boolean containsLocale(@Nullable String sLanguage, @Nullable String sCountry)
sLanguage - The language to check.sCountry - The country to check.true if it is in the cache, false
otherwise.public boolean containsLocale(@Nullable String sLanguage, @Nullable String sCountry, @Nullable String sVariant)
sLanguage - The language to check.sCountry - The country to check.sVariant - The variant to check.true if it is in the cache, false
otherwise.public void reinitialize()
Copyright © 2014–2019 Philip Helger. All rights reserved.