Skip to content

Commit 756ee61

Browse files
committed
Improve Javadoc of tryMerge
1 parent 2279c11 commit 756ee61

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/instant/InstantPatternDynamicFormatter.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,30 @@ abstract static class PatternSequence {
408408
/**
409409
* Tries to merge two pattern sequences.
410410
*
411+
* <p>
412+
* If not {@link null}, the pattern sequence returned by this method must:
413+
* </p>
414+
* <ol>
415+
* <li>Have a {@link #precision}, which is the minimum of the precisions of the two merged sequences.</li>
416+
* <li>
417+
* Create formatters that are equivalent to the concatenation of the formatters produced by the
418+
* two merged sequences.
419+
* </li>
420+
* </ol>
421+
* <p>
422+
* The returned pattern sequence should try to achieve these two goals:
423+
* </p>
424+
* <ol>
425+
* <li>
426+
* Create formatters which are faster than the concatenation of the formatters produced by the
427+
* two merged sequences.
428+
* </li>
429+
* <li>
430+
* It should be {@link null} if one of the pattern sequences is effectively constant over
431+
* {@code thresholdPrecision}, but the other one is not.
432+
* </li>
433+
* </ol>
434+
*
411435
* @param other A pattern sequence.
412436
* @param thresholdPrecision A precision threshold to determine effectively constant sequences.
413437
* This prevents merging effectively constant and dynamic pattern sequences.

0 commit comments

Comments
 (0)