Class AbstractLocaleResolver
- java.lang.Object
-
- com.aspectran.core.support.i18n.locale.AbstractLocaleResolver
-
- All Implemented Interfaces:
LocaleResolver
- Direct Known Subclasses:
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 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.protected java.util.LocaleresolveDefaultLocale(Translet translet)Resolve the default locale for the given translet, Called if can not find specified Locale.protected java.util.TimeZoneresolveDefaultTimeZone(Translet translet)Resolve the default time zone for the given translet, Called if can not find specified TimeZone.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.voidsetLocale(Translet translet, java.util.Locale locale)Set the current locale to the given one.voidsetTimeZone(Translet translet, java.util.TimeZone timeZone)Set the current timezone to the given one.-
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
-
-
-
-
Method Detail
-
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
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
-
resolveDefaultLocale
protected java.util.Locale resolveDefaultLocale(Translet translet)
Resolve 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)
-
resolveDefaultTimeZone
protected java.util.TimeZone resolveDefaultTimeZone(Translet translet)
Resolve 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)
-
setLocale
public void setLocale(Translet translet, java.util.Locale locale)
Description copied from interface:LocaleResolverSet the current locale to the given one.- Specified by:
setLocalein interfaceLocaleResolver- Parameters:
translet- the translet to resolve the locale forlocale- the new locale, ornullto clear the locale
-
setTimeZone
public void setTimeZone(Translet translet, java.util.TimeZone timeZone)
Description copied from interface:LocaleResolverSet the current timezone to the given one.- Specified by:
setTimeZonein interfaceLocaleResolver- Parameters:
translet- the translet to resolve the locale fortimeZone- the new timezone, ornullto clear the timezone
-
-