Class TableBuilder
- java.lang.Object
-
- com.github.database.rider.core.dataset.builder.TableBuilder
-
public class TableBuilder extends Object
-
-
Constructor Summary
Constructors Constructor Description TableBuilder(DataSetBuilder dataSetBuilder, String tableName, DBUnitConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.dbunit.dataset.IDataSetbuild()ColumnBuildercolumns(String... columns)Simplified syntax for row creation which specifies columns only once and then declare values of each row:ColumnBuildercolumns(javax.persistence.metamodel.Attribute... columns)Simplified syntax for row creation, using JPA metalmodel (type safe), specifying columns only once and then declare values of each row:TableBuilderdefaultValue(String columnName, Object value)Adds a default value for the given column in current table.protected RowBuildergetCurrentRowBuilder()protected DataSetBuildergetDataSetBuilder()RowBuilderrow()Starts row creation for current table:protected voidsaveCurrentRow()protected voidsaveCurrentRow(BasicRowBuilder rowBuilder)TableBuildertable(String table)
-
-
-
Constructor Detail
-
TableBuilder
public TableBuilder(DataSetBuilder dataSetBuilder, String tableName, DBUnitConfig config)
-
-
Method Detail
-
row
public RowBuilder row()
Starts row creation for current table:builder.table("user") .row() .column("id", 1) .column("name", "@dbunit") .row() .column("id", 2) .column("name", "@dbrider").build();- Returns:
- a row builder for adding rows on current table
-
columns
public ColumnBuilder columns(String... columns)
Simplified syntax for row creation which specifies columns only once and then declare values of each row:builder.table("user") .columns("id", "name") .values(1,"@dbunit") .values(2,"@dbrider").build();- Parameters:
columns- name of the column(s) to add in current table- Returns:
- a column builder responsible for creating rows for specified
columns
-
columns
public ColumnBuilder columns(javax.persistence.metamodel.Attribute... columns)
Simplified syntax for row creation, using JPA metalmodel (type safe), specifying columns only once and then declare values of each row:
The actual name of the column will be extracted from the metamodelbuilder.table("user") .columns(User_id, User_name) .values(1,"@dbunit") .values(2,"@dbrider").build();- Parameters:
columns- list of JPA metamodel columns to add in current table.- Returns:
- a column builder responsible for creating rows for specified
columns
-
getCurrentRowBuilder
protected RowBuilder getCurrentRowBuilder()
-
getDataSetBuilder
protected DataSetBuilder getDataSetBuilder()
-
saveCurrentRow
protected void saveCurrentRow()
-
saveCurrentRow
protected void saveCurrentRow(BasicRowBuilder rowBuilder)
-
defaultValue
public TableBuilder defaultValue(String columnName, Object value)
Adds a default value for the given column in current table. The default value will be used only if the column is not specified- Parameters:
columnName- name of the columnvalue- the value- Returns:
- table builder for starting adding rows on current table
-
table
public TableBuilder table(String table)
-
build
public org.dbunit.dataset.IDataSet build()
-
-