Package org.jdbi.v3.core.extension
Class Extensions
java.lang.Object
org.jdbi.v3.core.extension.Extensions
- All Implemented Interfaces:
JdbiConfig<Extensions>
Configuration class for defining
Jdbi
extensions via ExtensionFactory
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this configuration object.<F extends ExtensionFactory>
Optional<F>findFactory
(Class<F> factoryType) Find the registered factory of the given type, if any<E> Optional<E>
findFor
(Class<E> extensionType, HandleSupplier handleSupplier) Create an extension instance if we have a factory that understands the extension type which has access to aHandle
through aHandleSupplier
.boolean
hasExtensionFor
(Class<?> extensionType) Returns true if an extension is registered for the given type.boolean
Returns whether Proxy classes are allowed to be used.void
Throw if proxy creation is disallowed.register
(ExtensionFactory factory) Register an extension factory.setAllowProxy
(boolean allowProxy) Allow usingProxy
to implement extensions.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
Constructor Details
-
Extensions
public Extensions()Create an emptyExtensionFactory
configuration.
-
-
Method Details
-
register
Register an extension factory.- Parameters:
factory
- the factory to register- Returns:
- this
-
hasExtensionFor
Returns true if an extension is registered for the given type.- Parameters:
extensionType
- the type to query.- Returns:
- true if a registered extension handles the type.
-
findFor
Create an extension instance if we have a factory that understands the extension type which has access to aHandle
through aHandleSupplier
.- Type Parameters:
E
- the extension type to create- Parameters:
extensionType
- the extension type to createhandleSupplier
- the handle supplier- Returns:
- an attached extension instance if a factory is found
-
findFactory
Find the registered factory of the given type, if any- Type Parameters:
F
- the factory type to find- Parameters:
factoryType
- the factory's type to find- Returns:
- the found factory, if any
-
setAllowProxy
Allow usingProxy
to implement extensions.- Parameters:
allowProxy
- whether to allow use of Proxy types- Returns:
- this
-
isAllowProxy
Returns whether Proxy classes are allowed to be used.- Returns:
- whether Proxy classes are allowed to be used.
-
createCopy
Description copied from interface:JdbiConfig
Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopy
in interfaceJdbiConfig<Extensions>
- Returns:
- a copy of this configuration object.
-
onCreateProxy
Throw if proxy creation is disallowed.
-