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
- Since:
- 2.25.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final int[]private final intprivate final StringFields inherited from class InstantPatternDynamicFormatter.PatternSequence
pattern, precision -
Constructor Summary
ConstructorsConstructorDescriptionSecondPatternSequence(int secondDigits, String separator, int fractionalDigits) -
Method Summary
Modifier and TypeMethodDescription(package private) InstantPatternFormattercreateFormatter(Locale locale, TimeZone timeZone) private static StringcreatePattern(int secondDigits, String separator, int fractionalDigits) private static ChronoUnitdeterminePrecision(int secondDigits, int digits) private voidformatFractionalDigits(StringBuilder buffer, Instant instant) private static voidformatMillis(StringBuilder buffer, Instant instant) private static voidformatPaddedSeconds(StringBuilder buffer, Instant instant) private static voidformatUnpaddedSeconds(StringBuilder buffer, Instant instant) (package private) @Nullable InstantPatternDynamicFormatter.PatternSequencetryMerge(InstantPatternDynamicFormatter.PatternSequence other, ChronoUnit thresholdPrecision) Tries to merge two pattern sequences.Methods inherited from class InstantPatternDynamicFormatter.PatternSequence
equals, escapeLiteral, hashCode, isConstantForDurationOf, mergePatterns, toString
-
Field Details
-
POWERS_OF_TEN
private static final int[] POWERS_OF_TEN -
secondDigits
private final int secondDigits -
separator
-
fractionalDigits
private final int fractionalDigits
-
-
Constructor Details
-
SecondPatternSequence
SecondPatternSequence(int secondDigits, String separator, int fractionalDigits)
-
-
Method Details
-
createPattern
-
determinePrecision
-
formatUnpaddedSeconds
-
formatPaddedSeconds
-
formatFractionalDigits
-
formatMillis
-
createFormatter
- Specified by:
createFormatterin classInstantPatternDynamicFormatter.PatternSequence
-
tryMerge
@Nullable InstantPatternDynamicFormatter.PatternSequence tryMerge(InstantPatternDynamicFormatter.PatternSequence other, ChronoUnit thresholdPrecision) Description copied from class:InstantPatternDynamicFormatter.PatternSequenceTries to merge two pattern sequences.If not
}, the pattern sequence returned by this method must:invalid @link
{@link null- 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
} if one of the pattern sequences is effectively constant over
invalid @link
{@link nullthresholdPrecision, 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
-