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
Constructors -
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 aHandlethrough aHandleSupplier.booleanhasExtensionFor(Class<?> extensionType) Returns true if an extension is registered for the given type.booleanReturns whether Proxy classes are allowed to be used.voidThrow if proxy creation is disallowed.register(ExtensionFactory factory) Register an extension factory.setAllowProxy(boolean allowProxy) Allow usingProxyto implement extensions.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
Constructor Details
-
Extensions
public Extensions()Create an emptyExtensionFactoryconfiguration.
-
-
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 aHandlethrough 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 usingProxyto 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:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin interfaceJdbiConfig<Extensions>- Returns:
- a copy of this configuration object.
-
onCreateProxy
Throw if proxy creation is disallowed.
-