-
- All Implemented Interfaces:
public final class ExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static BooleanisKotlinClass(Class<?> $self)Returns true if the Class object represents a Kotlin class. final static <T extends JdbiConfig<T>> TgetConfig(StatementContext $self, KClass<T> kClass)Convenience helper to use any KClass for config lookup. final static <T extends Any> ResultIterable<T>mapTo(ResultBearing $self)Use a reified parameter to map the result. final static <T extends Any> ResultIterable<T>mapTo(ResultBearing $self, KClass<T> kClass)Map to a Kotlin class. final static <O extends Any> UnituseSequence(ResultIterable<O> $self, Function1<Sequence<O>, Unit> block)Stream all the rows of the result set out with a Sequence. final static <This extends SqlStatement<This>> ThisbindKotlin(SqlStatement<This> $self, String prefix, Object obj)Bind all the member properties of a given Kotlin object. final static <This extends SqlStatement<This>> ThisbindKotlin(SqlStatement<This> $self, Object obj)Bind all the member properties of a given Kotlin object. final static <This extends Configurable<This>, C extends JdbiConfig<C>> Thisconfigure(Configurable<This> $self, KClass<C> configClass, Consumer<C> configurer)Convenience method for Configurable.configure using Kotlin class syntax. final static <E extends Any, R extends Any, X extends Exception> RwithExtension(Jdbi $self, KClass<E> extensionType, ExtensionCallback<R, E, X> callback)A convenience method which opens an extension of the given type, yields it to a callback, and returns the result of the callback. final static <E extends Any, X extends Exception> UnituseExtension(Jdbi $self, KClass<E> extensionType, ExtensionConsumer<E, X> callback)A convenience method which opens an extension of the given type, and yields it to a callback. final static Set<Annotation>getQualifiers(KAnnotatedElement elements)Returns the set of qualifying annotations on the given Kotlin elements. -
-
Method Detail
-
isKotlinClass
final static Boolean isKotlinClass(Class<?> $self)
Returns true if the Class object represents a Kotlin class.
-
getConfig
final static <T extends JdbiConfig<T>> T getConfig(StatementContext $self, KClass<T> kClass)
Convenience helper to use any KClass for config lookup.
-
mapTo
final static <T extends Any> ResultIterable<T> mapTo(ResultBearing $self)
Use a reified parameter to map the result.
-
mapTo
final static <T extends Any> ResultIterable<T> mapTo(ResultBearing $self, KClass<T> kClass)
Map to a Kotlin class.
- Parameters:
kClass- the type to map the result set rows to.
-
useSequence
final static <O extends Any> Unit useSequence(ResultIterable<O> $self, Function1<Sequence<O>, Unit> block)
Stream all the rows of the result set out with a Sequence. Handles closing of the underlying iterator.
handle.createQuery(...).mapTo<Result>().useSequence { var firstResult = it.first() }
-
bindKotlin
final static <This extends SqlStatement<This>> This bindKotlin(SqlStatement<This> $self, String prefix, Object obj)
Bind all the member properties of a given Kotlin object.
- Parameters:
prefix- A prefix for the property names.obj- The object to bind.
-
bindKotlin
final static <This extends SqlStatement<This>> This bindKotlin(SqlStatement<This> $self, Object obj)
Bind all the member properties of a given Kotlin object.
- Parameters:
obj- The object to bind.
-
configure
final static <This extends Configurable<This>, C extends JdbiConfig<C>> This configure(Configurable<This> $self, KClass<C> configClass, Consumer<C> configurer)
Convenience method for Configurable.configure using Kotlin class syntax.
- Parameters:
configClass- – the configuration typeconfigurer- – consumer that will be passed the configuration object
-
withExtension
final static <E extends Any, R extends Any, X extends Exception> R withExtension(Jdbi $self, KClass<E> extensionType, ExtensionCallback<R, E, X> callback)
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.
- Parameters:
extensionType- the type of extension.callback- a callback which will receive the extension.
-
useExtension
final static <E extends Any, X extends Exception> Unit useExtension(Jdbi $self, KClass<E> extensionType, ExtensionConsumer<E, X> callback)
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 extensioncallback- a callback which will receive the extension
-
getQualifiers
final static Set<Annotation> getQualifiers(KAnnotatedElement elements)
Returns the set of qualifying annotations on the given Kotlin elements.
- Parameters:
elements- the annotated element.
-
-
-
-