public class SimpleLocaleContext extends Object implements LocaleContext
LocaleContext
interface,
always returning a specified Locale
.LocaleContextHolder.setLocaleContext(org.springframework.context.i18n.LocaleContext)
,
LocaleContextHolder.getLocale()
,
SimpleTimeZoneAwareLocaleContext
Constructor and Description |
---|
SimpleLocaleContext(Locale locale)
Create a new
SimpleLocaleContext that exposes the specified Locale . |
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Return the current Locale, which can be fixed or determined dynamically,
depending on the implementation strategy.
|
String |
toString() |
public SimpleLocaleContext(@Nullable Locale locale)
SimpleLocaleContext
that exposes the specified Locale
.
Every getLocale()
call will return this locale.
locale
- the Locale
to expose, or null
for no specific one@Nullable public Locale getLocale()
LocaleContext
getLocale
in interface LocaleContext
null
if no specific Locale associated