Class AbstractDatabaseSupport

java.lang.Object
io.bloviate.ext.AbstractDatabaseSupport
All Implemented Interfaces:
DatabaseSupport
Direct Known Subclasses:
DefaultSupport, H2Support, MySQLSupport, PostgresSupport, SQLiteSupport

public abstract class AbstractDatabaseSupport extends Object implements DatabaseSupport
Base DatabaseSupport that maps columns to generators through a JDBCType-keyed registry of GeneratorFactory entries.

The constructor seeds the registry with cross-database defaults and then invokes configure(Map), which database-specific subclasses override to add or replace entries (for example, to handle driver-specific type names). Types absent from the registry are unsupported and cause getDataGenerator(Column, RandomGenerator) to throw.

See Also:
  • Constructor Details

    • AbstractDatabaseSupport

      protected AbstractDatabaseSupport()
      Builds the support, seeding the registry with cross-database defaults and then invoking configure(Map) so subclasses can add or replace entries.
  • Method Details

    • getDataGenerator

      public final DataGenerator<?> getDataGenerator(Column column, RandomGenerator random)
      Description copied from interface: DatabaseSupport
      Creates an appropriate data generator for the given column based on its JDBCType (and, where relevant, its database-specific type name).
      Specified by:
      getDataGenerator in interface DatabaseSupport
      Parameters:
      column - the column metadata including type and constraints
      random - the random number generator for seeded data generation
      Returns:
      a data generator appropriate for the column type
    • configure

      protected void configure(Map<JDBCType, GeneratorFactory> registry)
      Hook for subclasses to add or replace generator factories for specific JDBC types. The supplied registry already holds the cross-database defaults; subclasses with no customizations need not override this method. Implementations must not retain a reference to the map beyond the call.
      Parameters:
      registry - the mutable registry to customize, keyed by JDBCType