public final class DateTimeContextHolder extends Object
DateTimeContext
.LocaleContextHolder
Modifier and Type | Method and Description |
---|---|
static DateTimeContext |
getDateTimeContext()
Return the DateTimeContext associated with the current thread, if any.
|
static DateTimeFormatter |
getFormatter(DateTimeFormatter formatter,
Locale locale)
Obtain a DateTimeFormatter with user-specific settings applied to the given base Formatter.
|
static void |
resetDateTimeContext()
Reset the DateTimeContext for the current thread.
|
static void |
setDateTimeContext(DateTimeContext dateTimeContext)
Associate the given DateTimeContext with the current thread.
|
public static void resetDateTimeContext()
public static void setDateTimeContext(@Nullable DateTimeContext dateTimeContext)
dateTimeContext
- the current DateTimeContext,
or null
to reset the thread-bound context@Nullable public static DateTimeContext getDateTimeContext()
null
if nonepublic static DateTimeFormatter getFormatter(DateTimeFormatter formatter, @Nullable Locale locale)
formatter
- the base formatter that establishes default formatting rules
(generally user independent)locale
- the current user locale (may be null
if not known)