Class TableFiller.Builder

java.lang.Object
io.bloviate.db.TableFiller.Builder
Enclosing class:
TableFiller

public static class TableFiller.Builder extends Object
Builder for constructing TableFiller instances.

Follows the builder pattern to assemble a filler for one table: the connection, database metadata, and DatabaseConfiguration are required, while the target table, an optional CommitStrategy override, and an optional row range are set fluently before build(). A TableFiller is typically created by DatabaseFiller once the fill order has been determined.

Since:
1.0.0
  • Constructor Details

    • Builder

      public Builder(Connection connection, Database database, DatabaseConfiguration databaseConfiguration)
      Creates a builder for a filler bound to the given connection, database metadata, and configuration.
      Parameters:
      connection - the database connection to fill on
      database - the database metadata, used to resolve tables and foreign-key relationships
      databaseConfiguration - the configuration controlling batch size, row counts, seed, and commit behavior
  • Method Details

    • table

      public TableFiller.Builder table(Table table)
      Sets the table to fill directly from its metadata.
      Parameters:
      table - the table to fill
      Returns:
      this builder
    • commitStrategy

      public TableFiller.Builder commitStrategy(CommitStrategy commitStrategy)
      Overrides the CommitStrategy for this table fill. When unset (or null), the configuration's strategy is used.
      Parameters:
      commitStrategy - the commit strategy to use, or null for the configuration default
      Returns:
      this builder
    • rowRange

      public TableFiller.Builder rowRange(long startInclusive, long endExclusive)
      Restricts this filler to a contiguous sub-range of the table's rows — one partition of an intra-table parallel fill. Generators are positioned to startInclusive so the produced values match the sequential fill for the corresponding rows (see TableFiller.seekGeneratorsTo(DataGenerator[], long[], long[], long)). When unset, the whole table is filled.
      Parameters:
      startInclusive - the first absolute (0-based) row to fill, inclusive
      endExclusive - the row to stop at, exclusive
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the range is negative or empty/inverted
    • build

      public TableFiller build()
      Builds a TableFiller from the configured parameters.
      Returns:
      a new filler ready to fill the configured table