withExtension

fun <E : Any, R, X : Exception> Jdbi.withExtension(extensionType: KClass<E>, callback: ExtensionCallback<R, E, X>): R

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

Return

the value returned by the callback.

Parameters

extensionType

the type of extension.

callback

a callback which will receive the extension.

the exception type optionally thrown by the callback

Throws

NoSuchExtensionException

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

if thrown by the callback.