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 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 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.protected java.util.Locale
resolveDefaultLocale(Translet translet)
Resolve the default locale for the given translet, Called if can not find specified Locale.protected java.util.TimeZone
resolveDefaultTimeZone(Translet translet)
Resolve the default time zone for the given translet, Called if can not find specified TimeZone.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
setLocale(Translet translet, java.util.Locale locale)
Set the current locale to the given one.void
setTimeZone(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
null
if none defined) - See Also:
setDefaultTimeZone(java.util.TimeZone)
-
setLocale
public void setLocale(Translet translet, java.util.Locale locale)
Description copied from interface:LocaleResolver
Set the current locale to the given one.- Specified by:
setLocale
in interfaceLocaleResolver
- Parameters:
translet
- the translet to resolve the locale forlocale
- the new locale, ornull
to clear the locale
-
setTimeZone
public void setTimeZone(Translet translet, java.util.TimeZone timeZone)
Description copied from interface:LocaleResolver
Set the current timezone to the given one.- Specified by:
setTimeZone
in interfaceLocaleResolver
- Parameters:
translet
- the translet to resolve the locale fortimeZone
- the new timezone, ornull
to clear the timezone
-
-