Class DefaultPresetTemporalFormatter

  • All Implemented Interfaces:
    IPresetTemporalFormatter

    public final class DefaultPresetTemporalFormatter
    extends Object
    implements IPresetTemporalFormatter
    Default implementation of IPresetTemporalFormatter that provides a builder for formatting temporal objects (like dates and times) into localized strings using predefined styles. Uses DateTimeFormatter 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 Detail

      • DefaultPresetTemporalFormatter

        public DefaultPresetTemporalFormatter​(Locale defaultLocale,
                                              ZoneId defaultZone)
    • 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 interface IPresetTemporalFormatter
        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.