Class LabelWrapper

  • All Implemented Interfaces:
    com.google.common.base.Function<java.lang.String,​java.lang.String>, java.util.function.Function<java.lang.String,​java.lang.String>

    public class LabelWrapper
    extends java.lang.Object
    implements com.google.common.base.Function<java.lang.String,​java.lang.String>
    A utility to wrap long lines, creating html strings with line breaks at a settable max line length
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String breaker  
      (package private) int lineLength  
    • Constructor Summary

      Constructors 
      Constructor Description
      LabelWrapper()
      Create an instance with default line break length = 10
      LabelWrapper​(int lineLength)
      Create an instance with passed line break length
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(java.lang.String str)
      call 'wrap' to transform the passed String
      static void main​(java.lang.String[] args)  
      private java.lang.String wrap​(java.lang.String str)
      line-wrap the passed String as an html string with break Strings inserted.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.google.common.base.Function

        equals
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • lineLength

        int lineLength
    • Constructor Detail

      • LabelWrapper

        public LabelWrapper()
        Create an instance with default line break length = 10
      • LabelWrapper

        public LabelWrapper​(int lineLength)
        Create an instance with passed line break length
        Parameters:
        lineLength - the max length for lines
    • Method Detail

      • apply

        public java.lang.String apply​(java.lang.String str)
        call 'wrap' to transform the passed String
        Specified by:
        apply in interface com.google.common.base.Function<java.lang.String,​java.lang.String>
        Specified by:
        apply in interface java.util.function.Function<java.lang.String,​java.lang.String>
      • wrap

        private java.lang.String wrap​(java.lang.String str)
        line-wrap the passed String as an html string with break Strings inserted.
        Parameters:
        str -
        Returns:
      • main

        public static void main​(java.lang.String[] args)