Class InstantFormatter

java.lang.Object
org.apache.logging.log4j.layout.template.json.util.InstantFormatter

@Deprecated public final class InstantFormatter extends Object
Deprecated.
Starting with version 2.25.0, this class is planned to be removed in the next major release.
A composite Instant formatter trying to employ either FixedDateFormat, FastDateFormat, or DateTimeFormatter in the given order due to performance reasons.

Note that FixedDateFormat and FastDateFormat only support millisecond precision. If the pattern asks for a higher precision, DateTimeFormatter will be employed, which is significantly slower.

  • Field Details

  • Constructor Details

  • Method Details

    • format

      public String format(Instant instant)
      Deprecated.
    • format

      public void format(Instant instant, StringBuilder stringBuilder)
      Deprecated.
    • isInstantMatching

      public boolean isInstantMatching(Instant instant1, Instant instant2)
      Deprecated.
      Checks if the given Instants are equal from the point of view of the employed formatter.

      This method should be preferred over

      invalid reference
      Instant#equals(Object)
      . For instance, FixedDateFormat and FastDateFormat discard nanoseconds, hence, from their point of view, two different Instants are equal if they match up to millisecond precision.
    • getInternalImplementationClass

      public Class<?> getInternalImplementationClass()
      Deprecated.
    • newBuilder

      public static InstantFormatter.Builder newBuilder()
      Deprecated.
    • patternSupported

      private static boolean patternSupported(String pattern, Locale locale, TimeZone timeZone, InstantFormatter.Formatter formatter)
      Deprecated.
      Checks if the provided formatter output matches with the one generated by DateTimeFormatter.