Class SimpleDateTimeFormatStyleProvider


  • final class SimpleDateTimeFormatStyleProvider
    extends DateTimeFormatStyleProvider
    The Service Provider Implementation to obtain date-time formatters for a style.

    This implementation is based on extraction of data from a SimpleDateFormat.

    Specification for implementors

    This class is immutable and thread-safe.
    • Field Detail

      • FORMATTER_CACHE

        private static final java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Object> FORMATTER_CACHE
        Cache of formatters.
    • Constructor Detail

      • SimpleDateTimeFormatStyleProvider

        SimpleDateTimeFormatStyleProvider()
    • Method Detail

      • getFormatter

        public DateTimeFormatter getFormatter​(FormatStyle dateStyle,
                                              FormatStyle timeStyle,
                                              Chronology chrono,
                                              java.util.Locale locale)
        Description copied from class: DateTimeFormatStyleProvider
        Gets a localized date, time or date-time formatter.

        The formatter will be the most appropriate to use for the date and time style in the locale. For example, some locales will use the month name while others will use the number.

        Specified by:
        getFormatter in class DateTimeFormatStyleProvider
        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
        chrono - the chronology to use, not null
        locale - the locale to use, not null
        Returns:
        the date-time formatter, not null
      • convertStyle

        private int convertStyle​(FormatStyle style)
        Converts the enum style to the old format style.
        Parameters:
        style - the enum style, not null
        Returns:
        the int style