Class TableBuilder


  • public class TableBuilder
    extends Object
    • 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:
         
          builder.table("user")
                 .columns(User_id, User_name)
                 .values(1,"@dbunit")
                 .values(2,"@dbrider").build();
         
         
        The actual name of the column will be extracted from the metamodel
        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()
      • 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 column
        value - the value
        Returns:
        table builder for starting adding rows on current table
      • build

        public org.dbunit.dataset.IDataSet build()