public class TableBuilder extends AbstractTableWriter implements org.apache.commons.lang3.builder.Builder<Table>
Builder to construct tables.
Constructor and Description |
---|
TableBuilder(List<String> columns) |
TableBuilder(TableLayout layout)
Construct a new builder using a particular layout.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(List<?> row)
Add a row to the table.
|
void |
addRow(Object... row)
Add a row to the table.
|
Table |
build() |
void |
close()
No-op close implementaiton.
|
TableLayout |
getLayout()
Get the layout of this table.
|
void |
writeRow(List<?> row)
Write a row to the table.
|
checkRowWidth, writeRow
public TableBuilder(TableLayout layout)
Construct a new builder using a particular layout.
layout
- The table layout.public TableLayout getLayout()
TableWriter
Get the layout of this table.
getLayout
in interface TableWriter
public void close()
AbstractTableWriter
No-op close implementaiton.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface TableWriter
close
in class AbstractTableWriter
public void writeRow(List<?> row)
TableWriter
Write a row to the table. This method is thread-safe.
writeRow
in interface TableWriter
row
- A row of values. If the table requires more columns, the remaining columns are empty. The row is copied if necessary; the caller is free to re-use the same array for returnValue calls.public void addRow(List<?> row)
Add a row to the table.
row
- The row to add.IllegalArgumentException
- if the row has the wrong length.public void addRow(Object... row)
Add a row to the table.
row
- The row to add.IllegalArgumentException
- if the row has the wrong length.