Class GeneratorRegistry
GeneratorFactory rules that lets callers override
data generation without subclassing DatabaseSupport.
A registry is attached to a
DatabaseConfiguration and consulted by the fill
engine for every column. It supports three kinds of matchers, resolved in a fixed, documented
order of precedence:
- column-name pattern — a case-insensitive regular expression matched
against
Column.name(); rules are tried in registration order and the first to match wins - vendor type name — an exact, case-insensitive match against
Column.typeName()(e.g."uuid","jsonb") JDBCType— a match againstColumn.jdbcType()
The registry sits between the highest-precedence per-column
ColumnConfiguration override and the built-in
DatabaseSupport defaults. The full engine precedence is therefore:
per-column ColumnConfiguration
> registry column-name pattern
> registry vendor typeName
> registry JDBCType
> built-in DatabaseSupport default
If no rule matches, resolve(Column, RandomGenerator) returns null and the engine falls
back to the DatabaseSupport default. Matched generators are constructed with the
engine-supplied, seeded RandomGenerator, so they remain reproducible like every built-in generator.
Instances are immutable and built through the GeneratorRegistry.Builder. External jars can contribute
rules automatically by providing a GeneratorPlugin discovered via
GeneratorRegistry.Builder.discover().
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionresolve(Column column, RandomGenerator random) Resolves the custom generator for a column, honouring the documented precedence (name pattern > vendor typeName > JDBCType).
-
Method Details
-
resolve
Resolves the custom generator for a column, honouring the documented precedence (name pattern > vendor typeName > JDBCType).- Parameters:
column- the column metadata to match againstrandom- the engine-seeded random source to construct the generator with- Returns:
- the matching generator, or
nullif no rule applies (caller should fall back to theDatabaseSupportdefault)
-