Class ListPrinter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class ListPrinter
    extends java.lang.Object
    implements java.io.Closeable
    Helper which assures consistent printing of lists prefixed with `start`, separated by `separator` and suffixed by `end`.
    If there is no item in the list then it prints `start` and then `end`
    If there is one item in the list then it prints `start`, item and then `end`
    If there is more then one items in the list then it prints `start`, items separated by `separator` and then `end`
    • Constructor Summary

      Constructors 
      Constructor Description
      ListPrinter​(TokenWriter printerHelper, boolean startPrefixSpace, java.lang.String start, boolean startSuffixSpace, boolean nextPrefixSpace, java.lang.String next, boolean nextSuffixSpace, boolean endPrefixSpace, java.lang.String end)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void printSeparatorIfAppropriate()
      Call that before printing of list item starts
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ListPrinter

        public ListPrinter​(TokenWriter printerHelper,
                           boolean startPrefixSpace,
                           java.lang.String start,
                           boolean startSuffixSpace,
                           boolean nextPrefixSpace,
                           java.lang.String next,
                           boolean nextSuffixSpace,
                           boolean endPrefixSpace,
                           java.lang.String end)
    • Method Detail

      • printSeparatorIfAppropriate

        public void printSeparatorIfAppropriate()
        Call that before printing of list item starts
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable