Package org.springframework.context.i18n
Class SimpleLocaleContext
- java.lang.Object
- org.springframework.context.i18n.SimpleLocaleContext
- All Implemented Interfaces:
LocaleContext
- Direct Known Subclasses:
SimpleTimeZoneAwareLocaleContext
public class SimpleLocaleContext extends Object implements LocaleContext
Simple implementation of theLocaleContextinterface, always returning a specifiedLocale.- Since:
- 1.2
- Author:
- Juergen Hoeller
- See Also:
LocaleContextHolder.setLocaleContext(org.springframework.context.i18n.LocaleContext),LocaleContextHolder.getLocale(),SimpleTimeZoneAwareLocaleContext
Constructor Summary
Constructors Constructor Description SimpleLocaleContext(Locale locale)Create a new SimpleLocaleContext that exposes the specified Locale.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalegetLocale()Return the current Locale, which can be fixed or determined dynamically, depending on the implementation strategy.StringtoString()
Constructor Detail
SimpleLocaleContext
public SimpleLocaleContext(@Nullable Locale locale)
Create a new SimpleLocaleContext that exposes the specified Locale. EverygetLocale()call will return this Locale.- Parameters:
locale- the Locale to expose, ornullfor no specific one
Method Detail
getLocale
@Nullable public Locale getLocale()
Description copied from interface:LocaleContextReturn the current Locale, which can be fixed or determined dynamically, depending on the implementation strategy.- Specified by:
getLocalein interfaceLocaleContext- Returns:
- the current Locale, or
nullif no specific Locale associated