Class DynamicWordAbbreviator


  • class DynamicWordAbbreviator
    extends NameAbbreviator

    Specialized abbreviator that shortens all words to the first char except the indicated number of rightmost words. To select this abbreviator, use pattern 1.n* where n (> 0) is the number of rightmost words to leave unchanged.

    By example for input org.apache.logging.log4j.core.pattern.NameAbbreviator:
     1.1*     =>   o.a.l.l.c.p.NameAbbreviator
     1.2*     =>   o.a.l.l.c.pattern.NameAbbreviator
     1.3*     =>   o.a.l.l.core.pattern.NameAbbreviator
     ..
     1.999*   =>   org.apache.logging.log4j.core.pattern.NameAbbreviator
     
    Since:
    2.19.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int rightWordCount
      Right-most number of words (at least one) that will not be abbreviated.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DynamicWordAbbreviator​(int rightWordCount)  
    • Field Detail

      • rightWordCount

        private final int rightWordCount
        Right-most number of words (at least one) that will not be abbreviated.
    • Constructor Detail

      • DynamicWordAbbreviator

        private DynamicWordAbbreviator​(int rightWordCount)
    • Method Detail

      • abbreviate

        public void abbreviate​(java.lang.String original,
                               java.lang.StringBuilder destination)
        Description copied from class: NameAbbreviator
        Abbreviates a name in a String.
        Specified by:
        abbreviate in class NameAbbreviator
        Parameters:
        original - the text to abbreviate, may not be null.
        destination - StringBuilder to write the result to
      • split

        static java.lang.String[] split​(java.lang.String input,
                                        char delim)