Class JodaTimeContext
- java.lang.Object
- org.springframework.format.datetime.joda.JodaTimeContext
public class JodaTimeContext extends Object
A context that holds user-specific Joda-Time settings such as the user's Chronology (calendar system) and time zone.A
null
property value indicate the user has not specified a setting.- Since:
- 3.0
- Author:
- Keith Donald
- See Also:
JodaTimeContextHolder
Constructor Summary
Constructors Constructor Description JodaTimeContext()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Chronology
getChronology()
Return the user's chronology (calendar system), if any.DateTimeFormatter
getFormatter(DateTimeFormatter formatter)
Get the DateTimeFormatter with the this context's settings applied to the baseformatter
.DateTimeZone
getTimeZone()
Return the user's time zone, if any.void
setChronology(Chronology chronology)
Set the user's chronology (calendar system).void
setTimeZone(DateTimeZone timeZone)
Set the user's time zone.
Constructor Detail
JodaTimeContext
public JodaTimeContext()
Method Detail
setChronology
public void setChronology(@Nullable Chronology chronology)
Set the user's chronology (calendar system).
getChronology
@Nullable public Chronology getChronology()
Return the user's chronology (calendar system), if any.
setTimeZone
public void setTimeZone(@Nullable DateTimeZone timeZone)
Set the user's time zone.Alternatively, set a
TimeZoneAwareLocaleContext
onLocaleContextHolder
. This context class will fall back to checking the locale context if no setting has been provided here.
getTimeZone
@Nullable public DateTimeZone getTimeZone()
Return the user's time zone, if any.
getFormatter
public DateTimeFormatter getFormatter(DateTimeFormatter formatter)
Get the DateTimeFormatter with the this context's settings applied to the baseformatter
.- Parameters:
formatter
- the base formatter that establishes default formatting rules, generally context-independent- Returns:
- the contextual DateTimeFormatter