Class DataTableBuilder

java.lang.Object
com.github.martincooper.datatable.DataTableBuilder

public class DataTableBuilder extends Object
DataTableBuilder. Used as a helper to create Data Tables. Created by Martin Cooper on 18/07/2017.
  • Method Details

    • create

      public static DataTableBuilder create(String tableName)
      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

      public <T> DataTableBuilder withColumn(Class<T> type, String columnName, Iterable<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.
    • 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

      public io.vavr.control.Try<DataTable> build()
      Attempts to build the data table from all the details in the chained method calls.
      Returns:
      Returns a Try DataTable.