public final class DateTimeContextHolder
extends java.lang.Object
DateTimeContext
.LocaleContextHolder
Constructor and Description |
---|
DateTimeContextHolder() |
Modifier and Type | Method and Description |
---|---|
static DateTimeContext |
getDateTimeContext()
Return the DateTimeContext associated with the current thread, if any.
|
static java.time.format.DateTimeFormatter |
getFormatter(java.time.format.DateTimeFormatter formatter,
java.util.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 java.time.format.DateTimeFormatter getFormatter(java.time.format.DateTimeFormatter formatter, @Nullable java.util.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)