Package org.springframework.context.i18n
Class SimpleTimeZoneAwareLocaleContext
- java.lang.Object
- org.springframework.context.i18n.SimpleLocaleContext
- org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
- All Implemented Interfaces:
LocaleContext
,TimeZoneAwareLocaleContext
public class SimpleTimeZoneAwareLocaleContext extends SimpleLocaleContext implements TimeZoneAwareLocaleContext
Simple implementation of theTimeZoneAwareLocaleContext
interface, always returning a specifiedLocale
andTimeZone
.Note: Prefer the use of
SimpleLocaleContext
when only setting a Locale but no TimeZone.- Since:
- 4.0
- Author:
- Juergen Hoeller, Nicholas Williams
- See Also:
LocaleContextHolder.setLocaleContext(org.springframework.context.i18n.LocaleContext)
,LocaleContextHolder.getTimeZone()
Constructor Summary
Constructors Constructor Description SimpleTimeZoneAwareLocaleContext(Locale locale, TimeZone timeZone)
Create a new SimpleTimeZoneAwareLocaleContext that exposes the specified Locale and TimeZone.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeZone
getTimeZone()
Return the current TimeZone, which can be fixed or determined dynamically, depending on the implementation strategy.String
toString()
Methods inherited from class org.springframework.context.i18n.SimpleLocaleContext
getLocale
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.context.i18n.LocaleContext
getLocale
Constructor Detail
SimpleTimeZoneAwareLocaleContext
public SimpleTimeZoneAwareLocaleContext(Locale locale, TimeZone timeZone)
Create a new SimpleTimeZoneAwareLocaleContext that exposes the specified Locale and TimeZone. EverySimpleLocaleContext.getLocale()
call will return the given Locale, and everygetTimeZone()
call will return the given TimeZone.- Parameters:
locale
- the Locale to exposetimeZone
- the TimeZone to expose
Method Detail
getTimeZone
public TimeZone getTimeZone()
Description copied from interface:TimeZoneAwareLocaleContext
Return the current TimeZone, which can be fixed or determined dynamically, depending on the implementation strategy.- Specified by:
getTimeZone
in interfaceTimeZoneAwareLocaleContext
- Returns:
- the current TimeZone, or
null
if no specific TimeZone associated
toString
public String toString()
- Overrides:
toString
in classSimpleLocaleContext