Class TableFiller.Builder
java.lang.Object
io.bloviate.db.TableFiller.Builder
- Enclosing class:
TableFiller
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 Summary
ConstructorsConstructorDescriptionBuilder(Connection connection, Database database, DatabaseConfiguration databaseConfiguration) Creates a builder for a filler bound to the given connection, database metadata, and configuration. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aTableFillerfrom the configured parameters.commitStrategy(CommitStrategy commitStrategy) Overrides theCommitStrategyfor this table fill.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.Sets the table to fill directly from its metadata.
-
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 ondatabase- the database metadata, used to resolve tables and foreign-key relationshipsdatabaseConfiguration- the configuration controlling batch size, row counts, seed, and commit behavior
-
-
Method Details
-
table
Sets the table to fill directly from its metadata.- Parameters:
table- the table to fill- Returns:
- this builder
-
commitStrategy
Overrides theCommitStrategyfor 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
Restricts this filler to a contiguous sub-range of the table's rows — one partition of an intra-table parallel fill. Generators are positioned tostartInclusiveso the produced values match the sequential fill for the corresponding rows (seeTableFiller.seekGeneratorsTo(DataGenerator[], long[], long[], long)). When unset, the whole table is filled.- Parameters:
startInclusive- the first absolute (0-based) row to fill, inclusiveendExclusive- the row to stop at, exclusive- Returns:
- this builder
- Throws:
IllegalArgumentException- if the range is negative or empty/inverted
-
build
Builds aTableFillerfrom the configured parameters.- Returns:
- a new filler ready to fill the configured table
-