useExtension

fun <E : Any, X : Exception> Jdbi.useExtension(extensionType: KClass<E>, callback: ExtensionConsumer<E, X>)

A convenience method which opens an extension of the given type, and yields it to a callback. A handle is opened if needed by the extention, and closed before returning to the caller.

Parameters

extensionType

the type of extension

callback

a callback which will receive the extension

the exception type optionally thrown by the callback

Throws

org.jdbi.v3.core.extension.NoSuchExtensionException

if no org.jdbi.v3.core.extension.ExtensionFactory is registered which supports the given extension type.

if thrown by the callback.