Class GeneratorRegistry

java.lang.Object
io.bloviate.ext.GeneratorRegistry

public final class GeneratorRegistry extends Object
A user-facing registry of custom 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:

  1. column-name pattern — a case-insensitive regular expression matched against Column.name(); rules are tried in registration order and the first to match wins
  2. vendor type name — an exact, case-insensitive match against Column.typeName() (e.g. "uuid", "jsonb")
  3. JDBCType — a match against Column.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:
  • Method Details

    • resolve

      public DataGenerator<?> resolve(Column column, RandomGenerator random)
      Resolves the custom generator for a column, honouring the documented precedence (name pattern > vendor typeName > JDBCType).
      Parameters:
      column - the column metadata to match against
      random - the engine-seeded random source to construct the generator with
      Returns:
      the matching generator, or null if no rule applies (caller should fall back to the DatabaseSupport default)