Class InstantPatternDynamicFormatter.DynamicPatternSequence
java.lang.Object
org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.DynamicPatternSequence
- Enclosing class:
InstantPatternDynamicFormatter
static final class InstantPatternDynamicFormatter.DynamicPatternSequence
extends InstantPatternDynamicFormatter.PatternSequence
Creates formatters that use
DateTimeFormatter.-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
pattern, precision -
Constructor Summary
ConstructorsConstructorDescriptionDynamicPatternSequence(String singlePattern) DynamicPatternSequence(String pattern, ChronoUnit precision) -
Method Summary
Modifier and TypeMethodDescription(package private) InstantPatternFormattercreateFormatter(Locale locale, TimeZone timeZone) private static ChronoUnitpatternPrecision(String singlePattern) private static StringremovePadding(String content) (package private) @Nullable InstantPatternDynamicFormatter.PatternSequencetryMerge(InstantPatternDynamicFormatter.PatternSequence other, ChronoUnit thresholdPrecision) Tries to merge two pattern sequences.private static voidvalidateContent(String content) Methods inherited from class org.apache.logging.log4j.core.util.internal.instant.InstantPatternDynamicFormatter.PatternSequence
equals, escapeLiteral, hashCode, isConstantForDurationOf, mergePatterns, toString
-
Constructor Details
-
DynamicPatternSequence
DynamicPatternSequence(String singlePattern) - Parameters:
singlePattern- ADateTimeFormatterpattern containing a single letter.
-
DynamicPatternSequence
DynamicPatternSequence(String pattern, ChronoUnit precision) - Parameters:
pattern- AnyDateTimeFormatterpattern.precision- The maximum interval of time over which this pattern is constant.
-
-
Method Details
-
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
-
patternPrecision
- Parameters:
singlePattern- a single-letter directive singlePattern complying (e.g.,H,HH, orpHH)- Returns:
- the time precision of the directive
-
validateContent
-
removePadding
-