@ThreadSafe @Singleton public class CountryCache extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
CountryCache() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsCountry(Locale aCountry)
Check if the passed country is known.
|
boolean |
containsCountry(String sCountry)
Check if the passed country is known.
|
ICommonsSet<String> |
getAllCountries() |
ICommonsSet<Locale> |
getAllCountryLocales() |
Locale |
getCountry(Locale aCountry)
The normed country locale associated with the provided locale.
|
Locale |
getCountry(String sCountry)
Resolve the country from the provided string.
|
Locale |
getCountryExt(Locale aCountry,
LocaleCache.IMissingLocaleHandler aMissingHandler)
The normed country locale associated with the provided locale.
|
Locale |
getCountryExt(String sCountry,
LocaleCache.IMissingLocaleHandler aMissingHandler)
Resolve the country from the provided string.
|
static CountryCache |
getInstance() |
static boolean |
isInstantiated() |
static boolean |
isSilentMode() |
void |
reinitialize()
Reset the cache to the initial state.
|
static boolean |
setSilentMode(boolean bSilentMode)
Enable or disable certain regular log messages.
|
public static boolean isSilentMode()
true if logging is disabled, false if it
is enabled.public static boolean setSilentMode(boolean bSilentMode)
bSilentMode - true to disable logging, false to enable
loggingpublic static boolean isInstantiated()
@Nonnull public static CountryCache getInstance()
null.@Nullable public Locale getCountry(@Nullable Locale aCountry)
aCountry - Source locale. May be null.null if the source locale is null or if
the source locale does not contain country information.@Nullable public Locale getCountryExt(@Nullable Locale aCountry, @Nullable LocaleCache.IMissingLocaleHandler aMissingHandler)
aCountry - Source locale. May be null.aMissingHandler - The missing locale handler to be passed to LocaleCache. May
be null to use LocaleCache default handler.null if the source locale is null or if
the source locale does not contain country information.@Nullable public Locale getCountry(@Nullable String sCountry)
sCountry - The country code. May be null or empty.null if the provided country code is null
or empty.@Nullable public Locale getCountryExt(@Nullable String sCountry, @Nullable LocaleCache.IMissingLocaleHandler aMissingHandler)
sCountry - The country code. May be null or empty.aMissingHandler - The missing locale handler to be passed to LocaleCache. May
be null to use LocaleCache default handler.null if the provided country code is null
or empty.@Nonnull @ReturnsMutableCopy public ICommonsSet<String> getAllCountries()
null.@Nonnull @ReturnsMutableCopy public ICommonsSet<Locale> getAllCountryLocales()
null.public boolean containsCountry(@Nullable Locale aCountry)
aCountry - The country to check. May be null.true if the passed country is contained,
false otherwise.public boolean containsCountry(@Nullable String sCountry)
sCountry - The country to check. May be null.true if the passed country is contained,
false otherwise.public final void reinitialize()
Copyright © 2014–2022 Philip Helger. All rights reserved.