public class TextTable
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TextTable.Alignment |
static class |
TextTable.Column |
static class |
TextTable.Row |
Modifier and Type | Field and Description |
---|---|
private java.util.List<TextTable.Column> |
columns |
private java.util.List<TextTable.Row> |
rows |
Constructor and Description |
---|
TextTable(java.util.List<TextTable.Column> columns) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.Object... values) |
void |
append(java.lang.StringBuilder destination,
java.lang.String lineEnding)
Appends the data formatted as a table to the given string builder.
|
java.lang.String |
build(java.lang.String lineEnding) |
void |
clear() |
static TextTable.Column |
column(java.lang.String header) |
static TextTable.Column |
column(java.lang.String header,
TextTable.Alignment alignment) |
java.util.List<TextTable.Column> |
getColumns() |
private void |
printRow(java.lang.StringBuilder destination,
java.util.List<java.lang.String> values) |
private void |
printSeparators(java.lang.StringBuilder destination) |
private final java.util.List<TextTable.Column> columns
private final java.util.List<TextTable.Row> rows
public TextTable(java.util.List<TextTable.Column> columns)
public static TextTable.Column column(java.lang.String header)
public static TextTable.Column column(java.lang.String header, TextTable.Alignment alignment)
public java.lang.String build(java.lang.String lineEnding)
public void append(java.lang.StringBuilder destination, java.lang.String lineEnding)
The generated table is compliant with the markdown file format.
destination
- a string builder to append the table tolineEnding
- the line ending to use for each row of the tableprivate void printSeparators(java.lang.StringBuilder destination)
private void printRow(java.lang.StringBuilder destination, java.util.List<java.lang.String> values)
public void add(@Nonnull java.lang.Object... values)
public void clear()
public java.util.List<TextTable.Column> getColumns()