Class TextTableHelper
java.lang.Object
org.sentrysoftware.metricshub.engine.common.helpers.TextTableHelper
Helper class providing methods for working with text tables.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateTextTable(String[] columns, List<List<String>> rows) static StringgenerateTextTable(String semiColonSeparatedColumns, List<List<String>> rows) static StringgenerateTextTable(Collection<String> columns, List<List<String>> rows) static StringgenerateTextTable(List<List<String>> rows) static StringgenerateTextTable(List<TableHeader> headers, List<List<String>> rows)
-
Method Details
-
generateTextTable
Creates a text table for the givenrows.
Each row is designed as aListofStringvalues.
The headers are generated as Column 1, Column 2, ..., with the number of columns being based on the number of columns in the longest row.- Parameters:
rows- TheListof rows.- Returns:
- A formatted text table representing the given rows.
-
generateTextTable
Creates a text table for the givenrows.
Each row is designed as aListofStringvalues.
The headers are generated based on semiColonSeparatedColumns (e.g. : column1;column2).- Parameters:
semiColonSeparatedColumns- A semicolon-separated list of column names.rows- TheListof rows.- Returns:
- A formatted text table representing the given rows, with the given column names as the headers.
-
generateTextTable
Creates a text table for the givenrows.
Each row is designed as aListofStringvalues.
The headers are generated based on columns (e.g. : new String[] {column1, column2}).- Parameters:
columns- An array of column names.rows- TheListof rows.- Returns:
- A formatted text table representing the given rows, with the given column names as the headers.
-
generateTextTable
Creates a text table for the givenrows.
Each row is designed as aListofStringvalues.
The headers are generated based on columns (e.g. : Arrays.asList(column1, column2)).- Parameters:
columns- AnCollectionof column names.rows- TheListof rows.- Returns:
- A formatted text table representing the given rows, with the given column names as the headers.
-
generateTextTable
Create a text table for the givenheadersand the correspondingrows.
Each row is designed as aListofStringvalues.- This method expects non-null
headersListand non-nullrowsList headersListcannot contain null values- The row
Listelements order is important and must match the same order as on theheadersList - A
nullrow is ignored - A row can be empty or having a size less than the
headerssize - Extra cells in a row are ignored
- This method expects non-null
-