Class DatePatternConverter

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DatePatternConverter​(@Nullable java.lang.String[] options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private static InstantFormatter createFormatter​(@Nullable java.lang.String[] options)  
      private static InstantFormatter createFormatterUnsafely​(@Nullable java.lang.String[] options)  
      (package private) static java.lang.String decodeNamedPattern​(java.lang.String pattern)
      Decodes FixedDateFormat named patterns into their corresponding DateTimeFormatter representations.
      void format​(long epochMillis, java.lang.StringBuilder buffer)
      Deprecated.
      Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
      void format​(@Nullable java.lang.Object object, java.lang.StringBuilder buffer)
      Formats an object into a string buffer.
      void format​(java.lang.StringBuilder buffer, @Nullable java.lang.Object... objects)
      Formats an array of Objects.
      void format​(java.util.Date date, java.lang.StringBuilder buffer)
      Deprecated.
      Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
      void format​(LogEvent event, java.lang.StringBuilder output)
      Formats an event into a string buffer.
      void format​(Instant instant, java.lang.StringBuilder buffer)
      Deprecated.
      Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
      java.lang.String getPattern()  
      java.util.TimeZone getTimeZone()  
      private static void logOptionReadFailure​(java.lang.String[] options, java.lang.Exception error, java.lang.String message)  
      static DatePatternConverter newInstance​(java.lang.String[] options)
      Obtains an instance of pattern converter.
      private static java.util.Locale readLocale​(@Nullable java.lang.String[] options)  
      private static java.lang.String readPattern​(@Nullable java.lang.String[] options)  
      private static java.util.TimeZone readTimeZone​(@Nullable java.lang.String[] options)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CLASS_NAME

        private static final java.lang.String CLASS_NAME
    • Constructor Detail

      • DatePatternConverter

        private DatePatternConverter​(@Nullable java.lang.String[] options)
    • Method Detail

      • createFormatter

        private static InstantFormatter createFormatter​(@Nullable java.lang.String[] options)
      • createFormatterUnsafely

        private static InstantFormatter createFormatterUnsafely​(@Nullable java.lang.String[] options)
      • readPattern

        private static java.lang.String readPattern​(@Nullable java.lang.String[] options)
      • decodeNamedPattern

        static java.lang.String decodeNamedPattern​(java.lang.String pattern)
        Decodes FixedDateFormat named patterns into their corresponding DateTimeFormatter representations.

        In version 2.25.0, FixedDateFormat and FastDateFormat are deprecated in favor of InstantPatternFormatter. We introduced this method to keep backward compatibility with the named patterns provided by FixedDateFormat.

        Parameters:
        pattern - a user provided date & time formatting pattern
        Returns:
        the transformed formatting pattern where FixedDateFormat named patterns are replaced with their corresponding DateTimeFormatter representations
        Since:
        2.25.0
      • readTimeZone

        private static java.util.TimeZone readTimeZone​(@Nullable java.lang.String[] options)
      • readLocale

        private static java.util.Locale readLocale​(@Nullable java.lang.String[] options)
      • logOptionReadFailure

        private static void logOptionReadFailure​(java.lang.String[] options,
                                                 java.lang.Exception error,
                                                 java.lang.String message)
      • newInstance

        public static DatePatternConverter newInstance​(java.lang.String[] options)
        Obtains an instance of pattern converter.
        Parameters:
        options - options, may be null.
        Returns:
        instance of pattern converter.
      • format

        @Deprecated
        public void format​(java.util.Date date,
                           java.lang.StringBuilder buffer)
        Deprecated.
        Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
        Formats the given date to the provided buffer.
        Parameters:
        date - a date
        buffer - a buffer to append to
      • format

        public void format​(LogEvent event,
                           java.lang.StringBuilder output)
        Description copied from class: LogEventPatternConverter
        Formats an event into a string buffer.
        Specified by:
        format in class LogEventPatternConverter
        Parameters:
        event - event to format, may not be null.
        output - string buffer to which the formatted event will be appended. May not be null.
      • format

        @Deprecated
        public void format​(long epochMillis,
                           java.lang.StringBuilder buffer)
        Deprecated.
        Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
        Formats the given epoch milliseconds to the provided buffer.
        Parameters:
        epochMillis - epoch milliseconds
        buffer - a buffer to append to
      • format

        @Deprecated
        public void format​(Instant instant,
                           java.lang.StringBuilder buffer)
        Deprecated.
        Starting with version 2.25.0, this method is deprecated and planned to be removed in the next major release.
        Formats the given instant to the provided buffer.
        Parameters:
        instant - an instant
        buffer - a buffer to append to
      • format

        public void format​(@Nullable java.lang.Object object,
                           java.lang.StringBuilder buffer)
        Description copied from class: LogEventPatternConverter
        Formats an object into a string buffer.
        Specified by:
        format in interface PatternConverter
        Overrides:
        format in class LogEventPatternConverter
        Parameters:
        object - event to format, may not be null.
        buffer - string buffer to which the formatted event will be appended. May not be null.
      • format

        public void format​(java.lang.StringBuilder buffer,
                           @Nullable java.lang.Object... objects)
        Description copied from interface: ArrayPatternConverter
        Formats an array of Objects.
        Specified by:
        format in interface ArrayPatternConverter
        Parameters:
        buffer - The StringBuilder to add the content to.
        objects - The Object array.
      • getPattern

        public java.lang.String getPattern()
        Returns:
        the pattern string describing this date format or null if the format does not have a pattern.
      • getTimeZone

        public java.util.TimeZone getTimeZone()
        Returns:
        the time zone used by this date format