Class ASCIITableReport

java.lang.Object
de.hybris.platform.util.ASCIITableReport

public class ASCIITableReport extends Object
This builder allows easily to build ASCII tables around any data. Note that this implementation is not thread-safe.
  • Field Details

  • Method Details

    • builder

      public static ASCIITableReport builder()
    • disableRowTitles

      public ASCIITableReport disableRowTitles()
      Disables all row titles which are normally displayed on left-hand side of the table.
    • enableRowTitles

      public ASCIITableReport enableRowTitles()
      Enables all row titles which were disabled with use of disableRowTitles() method.
    • withTopHeaders

      public ASCIITableReport withTopHeaders(String... headers)
      Allows to define top columns headers. Headers will be printed in the same order as passed to this method.
       builder.withTopHeaders("Foo", "Bar", "Baz")
       
      Parameters:
      headers - top column headers in form of varargs.
    • addDataRow

      public ASCIITableReport addDataRow(String... dataRow)
      Adds data row to the report. Row will be printed in the same order as passed to this method. If method titledBy(String) will be used as next in chain title for this row will be printed out as very first on the left hand side.
       builder.addDataRow("foo", "bar", "baz")
       
      Parameters:
      dataRow - data row in form of varargs.
    • titledBy

      public ASCIITableReport titledBy(String rowTitle)
      Title for the last data row defined by addDataRow(String...) method. This method must be used right after call to addDataRow(String...) to apply it to correct row.
       builder.addDataRow("foo", "bar", "baz").titledBy("My Row")
       
      Parameters:
      rowTitle - title for the last defined data row
    • printTable

      public void printTable()
      Prints report as ASCII table to the standard output.
    • getTable

      public String getTable()
      Gets report as ASCII table in the String.