Class DateTimeFormatterProvider

  • Direct Known Subclasses:
    DateTimeFormatterProviderImpl

    public abstract class DateTimeFormatterProvider
    extends java.util.spi.LocaleServiceProvider
    The Service Provider Interface (SPI) to be implemented by classes providing date-time formatting information.

    DateTimeFormatterProvider is an abstract class and must be implemented with care. Implementations must be thread-safe. It is strongly recommended that implementations cache the returned formatters.

    • Constructor Detail

      • DateTimeFormatterProvider

        public DateTimeFormatterProvider()
    • Method Detail

      • getFormatter

        public abstract DateTimeFormatter getFormatter​(DateTimeFormatterBuilder.FormatStyle dateStyle,
                                                       DateTimeFormatterBuilder.FormatStyle timeStyle,
                                                       java.util.Locale locale,
                                                       Chronology chronology)
        Gets a localized date, time or date-time format.
        Parameters:
        dateStyle - the date formatter style to obtain, null to obtain a time formatter
        timeStyle - the time formatter style to obtain, null to obtain a date formatter
        locale - the locale to use, not null
        chronology - the chronology to use, not null
        Returns:
        the date-time formatter, never null
        Throws:
        java.lang.IllegalArgumentException - if both format styles are null
        java.lang.IllegalArgumentException - if the locale is not a recognized locale