Package de.hybris.platform.util
Class ASCIITableReport
- java.lang.Object
-
- de.hybris.platform.util.ASCIITableReport
-
public class ASCIITableReport extends java.lang.ObjectThis builder allows easily to build ASCII tables around any data. Note that this implementation is not thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEMPTY_CELL_MARKER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ASCIITableReportaddDataRow(java.lang.String... dataRow)Adds data row to the report.static ASCIITableReportbuilder()ASCIITableReportdisableRowTitles()Disables all row titles which are normally displayed on left-hand side of the table.ASCIITableReportenableRowTitles()Enables all row titles which were disabled with use ofdisableRowTitles()method.java.lang.StringgetTable()Gets report as ASCII table in the String.voidprintTable()Prints report as ASCII table to the standard output.ASCIITableReporttitledBy(java.lang.String rowTitle)Title for the last data row defined byaddDataRow(String...)method.ASCIITableReportwithTopHeaders(java.lang.String... headers)Allows to define top columns headers.
-
-
-
Field Detail
-
EMPTY_CELL_MARKER
public static final java.lang.String EMPTY_CELL_MARKER
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 ofdisableRowTitles()method.
-
withTopHeaders
public ASCIITableReport withTopHeaders(java.lang.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(java.lang.String... dataRow)
Adds data row to the report. Row will be printed in the same order as passed to this method. If methodtitledBy(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(java.lang.String rowTitle)
Title for the last data row defined byaddDataRow(String...)method. This method must be used right after call toaddDataRow(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 java.lang.String getTable()
Gets report as ASCII table in the String.
-
-