Class InstantPatternDynamicFormatter.SecondPatternSequence
- java.lang.Object
-
- org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
-
- org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.SecondPatternSequence
-
- Enclosing class:
- InstantPatternDynamicFormatter
static class InstantPatternDynamicFormatter.SecondPatternSequence extends InstantPatternDynamicFormatter.PatternSequence
-
-
Field Summary
Fields Modifier and Type Field Description private intfractionalDigitsprivate static int[]POWERS_OF_TENprivate intsecondDigitsprivate java.lang.Stringseparator-
Fields inherited from class org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
pattern, precision
-
-
Constructor Summary
Constructors Constructor Description SecondPatternSequence(int secondDigits, java.lang.String separator, int fractionalDigits)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) InstantPatternFormattercreateFormatter(java.util.Locale locale, java.util.TimeZone timeZone)private static java.lang.StringcreatePattern(int secondDigits, java.lang.String separator, int fractionalDigits)private static java.time.temporal.ChronoUnitdeterminePrecision(int secondDigits, int digits)private voidformatFractionalDigits(java.lang.StringBuilder buffer, Instant instant)private static voidformatMillis(java.lang.StringBuilder buffer, Instant instant)private static voidformatPaddedSeconds(java.lang.StringBuilder buffer, Instant instant)private static voidformatUnpaddedSeconds(java.lang.StringBuilder buffer, Instant instant)(package private) @Nullable InstantPatternDynamicFormatter.PatternSequencetryMerge(InstantPatternDynamicFormatter.PatternSequence other, java.time.temporal.ChronoUnit thresholdPrecision)Tries to merge two pattern sequences.-
Methods inherited from class org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
equals, escapeLiteral, hashCode, isConstantForDurationOf, mergePatterns, toString
-
-
-
-
Method Detail
-
createPattern
private static java.lang.String createPattern(int secondDigits, java.lang.String separator, int fractionalDigits)
-
determinePrecision
private static java.time.temporal.ChronoUnit determinePrecision(int secondDigits, int digits)
-
formatUnpaddedSeconds
private static void formatUnpaddedSeconds(java.lang.StringBuilder buffer, Instant instant)
-
formatPaddedSeconds
private static void formatPaddedSeconds(java.lang.StringBuilder buffer, Instant instant)
-
formatFractionalDigits
private void formatFractionalDigits(java.lang.StringBuilder buffer, Instant instant)
-
formatMillis
private static void formatMillis(java.lang.StringBuilder buffer, Instant instant)
-
createFormatter
InstantPatternFormatter createFormatter(java.util.Locale locale, java.util.TimeZone timeZone)
- Specified by:
createFormatterin classInstantPatternDynamicFormatter.PatternSequence
-
tryMerge
@Nullable InstantPatternDynamicFormatter.PatternSequence tryMerge(InstantPatternDynamicFormatter.PatternSequence other, java.time.temporal.ChronoUnit thresholdPrecision)
Description copied from class:InstantPatternDynamicFormatter.PatternSequenceTries to merge two pattern sequences.If not {@link null}, the pattern sequence returned by this method must:
- Have a
InstantPatternDynamicFormatter.PatternSequence.precision, which is the minimum of the precisions of the two merged sequences. - Create formatters that are equivalent to the concatenation of the formatters produced by the two merged sequences.
The returned pattern sequence should try to achieve these two goals:
- Create formatters which are faster than the concatenation of the formatters produced by the two merged sequences.
-
It should be {@link null} if one of the pattern sequences is effectively constant over
thresholdPrecision, but the other one is not.
- Specified by:
tryMergein classInstantPatternDynamicFormatter.PatternSequence- Parameters:
other- A pattern sequence.thresholdPrecision- A precision threshold to determine effectively constant sequences. This prevents merging effectively constant and dynamic pattern sequences.- Returns:
- A merged formatter factory or
nullif merging is not possible.
- Have a
-
-