- Type Parameters:
LB- The specific subtype ofLitebridgeCorethis builder will construct based on the database provider.
The constructed Litebridge instance type depends on the capabilities of the specified database provider.
Some database providers may provide a specialised Litebridge implementation that supports
additional vendor-specific features, or they may limit the default Litebridge API due to lack of support for
features like SQL MERGE INTO operations (in which case a LitebridgeCore instance is returned).
This builder provides a fluent API for configuring dependencies and optional parameters used during the instantiation of the Litebridge instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordConstructor arguments for a custom database provider-provided Litebridge instance. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Constructs the Litebridge instance based on the configuration provided to this builder.withConfig(LitebridgeConfig config) Sets the Litebridge configuration to be used by the Litebridge instance.withDataSource(DataSource dataSource) Sets the data source to be used by the Litebridge instance, using the default transaction manager.withLookup(MethodHandles.Lookup lookup) Sets the method handle lookup to be used by the Litebridge instance.withTransactionManager(TransactionManager transactionManager) Sets the transaction manager to be used by the Litebridge instance.
-
Method Details
-
withDataSource
Sets the data source to be used by the Litebridge instance, using the default transaction manager.This is not needed if
withTransactionManager(TransactionManager)is used.- Parameters:
dataSource- the data source to use- Returns:
- this builder instance for method chaining
-
withTransactionManager
Sets the transaction manager to be used by the Litebridge instance.- Parameters:
transactionManager- the transaction manager to use- Returns:
- this builder instance for method chaining
-
withConfig
Sets the Litebridge configuration to be used by the Litebridge instance.- Parameters:
config- the Litebridge configuration to use- Returns:
- this builder instance for method chaining
-
withLookup
Sets the method handle lookup to be used by the Litebridge instance.- Parameters:
lookup- the method handle lookup to use- Returns:
- this builder instance for method chaining
-
build
Constructs the Litebridge instance based on the configuration provided to this builder.The constructed Litebridge instance type depends on the capabilities of the specified database provider. Some database providers may provide a specialised Litebridge implementation that supports additional vendor-specific features, or they may limit the default Litebridge API due to lack of support for features like SQL
MERGE INTOoperations (in which case aLitebridgeCoreinstance is returned).- Returns:
- the constructed Litebridge instance
-