Class AbstractDatabaseSupport
java.lang.Object
io.bloviate.ext.AbstractDatabaseSupport
- All Implemented Interfaces:
DatabaseSupport
- Direct Known Subclasses:
DefaultSupport, H2Support, MySQLSupport, PostgresSupport, SQLiteSupport
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 Summary
ConstructorsModifierConstructorDescriptionprotectedBuilds the support, seeding the registry with cross-database defaults and then invokingconfigure(Map)so subclasses can add or replace entries. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(Map<JDBCType, GeneratorFactory> registry) Hook for subclasses to add or replace generator factories for specific JDBC types.final DataGenerator<?> getDataGenerator(Column column, RandomGenerator random) Creates an appropriate data generator for the given column based on itsJDBCType(and, where relevant, its database-specific type name).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DatabaseSupport
batchRewriteUrlParameter, disableConstraints, enableConstraints, readConstraints, supportsBulkLoad
-
Constructor Details
-
AbstractDatabaseSupport
protected AbstractDatabaseSupport()Builds the support, seeding the registry with cross-database defaults and then invokingconfigure(Map)so subclasses can add or replace entries.
-
-
Method Details
-
getDataGenerator
Description copied from interface:DatabaseSupportCreates an appropriate data generator for the given column based on itsJDBCType(and, where relevant, its database-specific type name).- Specified by:
getDataGeneratorin interfaceDatabaseSupport- Parameters:
column- the column metadata including type and constraintsrandom- the random number generator for seeded data generation- Returns:
- a data generator appropriate for the column type
-
configure
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 byJDBCType
-