Top Description Fields Constructors Methods
org.springframework.context.i18n

public Class SimpleLocaleContext

extends Object
implements LocaleContext
Class Inheritance
All Implemented Interfaces
org.springframework.context.i18n.LocaleContext
Known Direct Subclasses
org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
Imports
java.util.Locale, org.springframework.lang.Nullable

Simple implementation of the LocaleContext interface, always returning a specified Locale.
Author
Juergen Hoeller
Since
1.2
See Also
LocaleContextHolder#setLocaleContext, LocaleContextHolder#getLocale(), SimpleTimeZoneAwareLocaleContext

Field Summary

Modifier and TypeField and Description
private final Locale

Constructor Summary

AccessConstructor and Description
public
SimpleLocaleContext(Locale
the Locale to expose, or null for no specific one
locale
)

Create a new SimpleLocaleContext that exposes the specified Locale.

Method Summary

Modifier and TypeMethod and Description
public Locale
getLocale()

Implements org.springframework.context.i18n.LocaleContext.getLocale.

Return the current Locale, which can be fixed or determined dynamically, depending on the implementation strategy.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

localeback to summary
private final Locale locale
Annotations
@Nullable

Constructor Detail

SimpleLocaleContextback to summary
public SimpleLocaleContext(Locale locale)

Create a new SimpleLocaleContext that exposes the specified Locale.

Every getLocale() call will return this locale.

Parameters
locale:Locale

the Locale to expose, or null for no specific one

Method Detail

getLocaleback to summary
public Locale getLocale()

Implements org.springframework.context.i18n.LocaleContext.getLocale.

Doc from org.springframework.context.i18n.LocaleContext.getLocale.

Return the current Locale, which can be fixed or determined dynamically, depending on the implementation strategy.

Returns:Locale

the current Locale, or null if no specific Locale associated

Annotations
@Override
@Nullable
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override