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 forLocaleResolver
implementations. 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.Locale
determineDefaultLocale(Translet translet)
Determines the default locale for the given translet.protected java.util.TimeZone
determineDefaultTimeZone(Translet translet)
Determines the default time zone for the given translet.java.util.Locale
getDefaultLocale()
Return the default Locale that this resolver is supposed to fall back to, if any.java.util.TimeZone
getDefaultTimeZone()
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.void
setDefaultLocale(java.lang.String defaultLocale)
Set a default Locale that this resolver will return if no other locale found.void
setDefaultLocale(java.util.Locale defaultLocale)
Set a default Locale that this resolver will return if no other locale found.void
setDefaultTimeZone(java.lang.String defaultTimeZone)
Set a default TimeZone that this resolver will return if no other time zone found.void
setDefaultTimeZone(java.util.TimeZone defaultTimeZone)
Set a default TimeZone that this resolver will return if no other time zone found.void
setSupportedLocales(java.lang.String[] locales)
Configure supported locales.void
setSupportedLocales(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)
Determines the default locale for the given translet.- 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)
Determines the default time zone for the given translet.- Parameters:
translet
- the translet to resolve the time zone for- Returns:
- the default time zone (or
null
if none defined) - See Also:
setDefaultTimeZone(java.util.TimeZone)
-
-