Class AbstractLocaleResolver
- java.lang.Object
-
- com.aspectran.core.support.i18n.locale.AbstractLocaleResolver
-
- All Implemented Interfaces:
LocaleResolver
- Direct Known Subclasses:
CookieLocaleResolver,FixedLocaleResolver,SessionLocaleResolver
public abstract class AbstractLocaleResolver extends java.lang.Object implements LocaleResolver
Abstract base class forLocaleResolverimplementations. Provides support for a default locale and timezone.Created: 2016. 3. 13.
-
-
Constructor Summary
Constructors Constructor Description AbstractLocaleResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.LocaledetermineDefaultLocale(Translet translet)Determine the default locale for the given translet, Called if can not find specified Locale.protected java.util.TimeZonedetermineDefaultTimeZone(Translet translet)Determine the default time zone for the given translet, Called if can not find specified TimeZone.java.util.LocalegetDefaultLocale()Return the default Locale that this resolver is supposed to fall back to, if any.java.util.TimeZonegetDefaultTimeZone()Return the default TimeZone that this resolver is supposed to fall back to, if any.java.util.List<java.util.Locale>getSupportedLocales()Return the configured list of supported locales.voidsetDefaultLocale(java.lang.String defaultLocale)Set a default Locale that this resolver will return if no other locale found.voidsetDefaultLocale(java.util.Locale defaultLocale)Set a default Locale that this resolver will return if no other locale found.voidsetDefaultTimeZone(java.lang.String defaultTimeZone)Set a default TimeZone that this resolver will return if no other time zone found.voidsetDefaultTimeZone(java.util.TimeZone defaultTimeZone)Set a default TimeZone that this resolver will return if no other time zone found.voidsetSupportedLocales(java.lang.String[] locales)Configure supported locales.voidsetSupportedLocales(java.util.List<java.util.Locale> locales)Configure supported locales.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.support.i18n.locale.LocaleResolver
resolveLocale, resolveTimeZone, setLocale, setTimeZone
-
-
-
-
Method Detail
-
getSupportedLocales
public java.util.List<java.util.Locale> getSupportedLocales()
Return the configured list of supported locales.
-
setSupportedLocales
public void setSupportedLocales(java.util.List<java.util.Locale> locales)
Configure supported locales.- Parameters:
locales- the supported locales
-
setSupportedLocales
public void setSupportedLocales(java.lang.String[] locales)
Configure supported locales.- Parameters:
locales- the supported locales
-
getDefaultLocale
public java.util.Locale getDefaultLocale()
Return the default Locale that this resolver is supposed to fall back to, if any.- Returns:
- the default locale
-
setDefaultLocale
public void setDefaultLocale(java.util.Locale defaultLocale)
Set a default Locale that this resolver will return if no other locale found.- Parameters:
defaultLocale- the default locale
-
setDefaultLocale
public void setDefaultLocale(java.lang.String defaultLocale)
Set a default Locale that this resolver will return if no other locale found.- Parameters:
defaultLocale- the default locale
-
getDefaultTimeZone
@Nullable public java.util.TimeZone getDefaultTimeZone()
Return the default TimeZone that this resolver is supposed to fall back to, if any.- Returns:
- the default time zone
-
setDefaultTimeZone
public void setDefaultTimeZone(java.util.TimeZone defaultTimeZone)
Set a default TimeZone that this resolver will return if no other time zone found.- Parameters:
defaultTimeZone- the default time zone
-
setDefaultTimeZone
public void setDefaultTimeZone(java.lang.String defaultTimeZone)
Set a default TimeZone that this resolver will return if no other time zone found.- Parameters:
defaultTimeZone- the default time zone
-
determineDefaultLocale
protected java.util.Locale determineDefaultLocale(Translet translet)
Determine the default locale for the given translet, Called if can not find specified Locale.- Parameters:
translet- the translet to resolve the locale for- Returns:
- the default locale (never
null) - See Also:
setDefaultLocale(java.util.Locale)
-
determineDefaultTimeZone
protected java.util.TimeZone determineDefaultTimeZone(Translet translet)
Determine the default time zone for the given translet, Called if can not find specified TimeZone.- Parameters:
translet- the translet to resolve the time zone for- Returns:
- the default time zone (or
nullif none defined) - See Also:
setDefaultTimeZone(java.util.TimeZone)
-
-