Class DataTableBuilder
java.lang.Object
com.github.martincooper.datatable.DataTableBuilder
DataTableBuilder. Used as a helper to create Data Tables.
Created by Martin Cooper on 18/07/2017.
-
Method Summary
Modifier and TypeMethodDescriptionio.vavr.control.Try<DataTable>build()Attempts to build the data table from all the details in the chained method calls.static DataTableBuilderCreates a new instance of a DataTableBuilder, passing table name.<T> DataTableBuilderwithColumn(Class<T> type, String columnName, Iterable<T> data) Allows an additional column to be added when building a table.final <T> DataTableBuilderwithColumn(Class<T> type, String columnName, T... data) Allows an additional column to be added when building a table.
-
Method Details
-
create
Creates a new instance of a DataTableBuilder, passing table name.- Parameters:
tableName- The name of the table.- Returns:
- Returns a new instance of a DataTableBuilder, allowing method chaining.
-
withColumn
Allows an additional column to be added when building a table.- Type Parameters:
T- The column type.- Parameters:
type- The data type of the column.columnName- The column name.data- The data contained in the column.- Returns:
- Adds a new column and returns an instance to the current Data Table Builder.
-
withColumn
@SafeVarargs public final <T> DataTableBuilder withColumn(Class<T> type, String columnName, T... data) Allows an additional column to be added when building a table.- Type Parameters:
T- The column type.- Parameters:
type- The data type of the column.columnName- The column name.data- The data contained in the column.- Returns:
- Adds a new column and returns an instance to the current Data Table Builder.
-
build
Attempts to build the data table from all the details in the chained method calls.- Returns:
- Returns a Try DataTable.
-