Class GeneratorRegistry.Builder
java.lang.Object
io.bloviate.ext.GeneratorRegistry.Builder
- Enclosing class:
GeneratorRegistry
Builds an immutable
GeneratorRegistry. Registration methods may be called in any
order and any number of times; register* methods return this for chaining.
Within a single matcher kind, later registrations win for vendor type names and
JDBCTypes (last-write replaces), while column-name patterns preserve registration
order (first match wins at resolution time).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the registry from the rules registered so far.discover()Discovers and applies everyGeneratorPluginvisible to the current thread's context class loader viaServiceLoader.register(GeneratorPlugin plugin) Applies aGeneratorPluginimmediately, letting it register rules at this point in the builder chain.registerColumnNamePattern(String regex, GeneratorFactory factory) Registers a generator for columns whosenamematches the given regular expression.registerJdbcType(JDBCType jdbcType, GeneratorFactory factory) Registers a generator override for aJDBCType.registerTypeName(String typeName, GeneratorFactory factory) Registers a generator for columns whose database-specifictype nameequals the given value, ignoring case (e.g.
-
Constructor Details
-
Builder
public Builder()Creates an empty builder with no rules registered.
-
-
Method Details
-
registerColumnNamePattern
Registers a generator for columns whosenamematches the given regular expression. Matching is full (Matcher.matches()) and case-insensitive — use"email"or".*_email"rather than relying on substring search. Patterns are evaluated in registration order; the first match wins.- Parameters:
regex- the column-name pattern (full-match, case-insensitive)factory- the generator factory to use on a match- Returns:
- this builder
-
registerTypeName
Registers a generator for columns whose database-specifictype nameequals the given value, ignoring case (e.g."uuid","jsonb").- Parameters:
typeName- the vendor type name to matchfactory- the generator factory to use on a match- Returns:
- this builder
-
registerJdbcType
Registers a generator override for aJDBCType. This takes precedence over the built-inDatabaseSupportdefault for that type.- Parameters:
jdbcType- the JDBC type to matchfactory- the generator factory to use on a match- Returns:
- this builder
-
register
Applies aGeneratorPluginimmediately, letting it register rules at this point in the builder chain.- Parameters:
plugin- the plugin to apply- Returns:
- this builder
-
discover
Discovers and applies everyGeneratorPluginvisible to the current thread's context class loader viaServiceLoader. Discovery order is not specified byServiceLoader; call this where you want discovered rules to apply relative to your explicit registrations.- Returns:
- this builder
-
build
Builds the registry from the rules registered so far.- Returns:
- an immutable registry holding the rules registered so far
-