Package de.xima.fc.common.time
Class DefaultPresetTemporalFormatter
- java.lang.Object
-
- de.xima.fc.common.time.DefaultPresetTemporalFormatter
-
- All Implemented Interfaces:
IPresetTemporalFormatter
public final class DefaultPresetTemporalFormatter extends Object implements IPresetTemporalFormatter
Default implementation ofIPresetTemporalFormatter
that provides a builder for formatting temporal objects (like dates and times) into localized strings using predefined styles. UsesDateTimeFormatter
to format the temporal objects based on the specified style.Allows specifying the default locale and zone provided at construction time.
- Since:
- 8.4.0
-
-
Constructor Summary
Constructors Constructor Description DefaultPresetTemporalFormatter(Locale defaultLocale, ZoneId defaultZone)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IPresetTemporalFormatterBuilder
forStyle(EPresetTemporalFormatStyle style)
Gets a builder for formatting a temporal object into a localized string.static IPresetTemporalFormatter
rootUtc()
Gets a preset formatter that uses the root locale and UTC as a fallback.static IPresetTemporalFormatter
system()
Gets a preset formatter that uses the system default locale and zone as a fallback.
-
-
-
Method Detail
-
forStyle
public IPresetTemporalFormatterBuilder forStyle(EPresetTemporalFormatStyle style)
Description copied from interface:IPresetTemporalFormatter
Gets a builder for formatting a temporal object into a localized string. Allows configuring various options. The returned builder is not thread-safe and should be used in a single thread only.- Specified by:
forStyle
in interfaceIPresetTemporalFormatter
- Parameters:
style
- The style to use for formatting, never null.- Returns:
- A builder for formatting a temporal object into a localized string, never null.
-
rootUtc
public static IPresetTemporalFormatter rootUtc()
Gets a preset formatter that uses the root locale and UTC as a fallback.- Returns:
- A preset formatter that uses the root locale and UTC as a fallback, never null.
-
system
public static IPresetTemporalFormatter system()
Gets a preset formatter that uses the system default locale and zone as a fallback.- Returns:
- A preset formatter that uses the system default locale and zone as a fallback, never null.
-
-