[[kotlin]]
= Kotlin

This part of the reference documentation explains the specific Kotlin functionality offered by Spring Data R2DBC.
See xref:kotlin.adoc[] for the general functionality provided by Spring Data.

To retrieve a list of `SWCharacter` objects in Java, you would normally write the following:

[source,java]
----
Flux<SWCharacter> characters = client.select().from(SWCharacter.class).fetch().all();
----

With Kotlin and the Spring Data extensions, you can instead write the following:

[source,kotlin]
----
val characters =  client.select().from<SWCharacter>().fetch().all()
// or (both are equivalent)
val characters : Flux<SWCharacter> = client.select().from().fetch().all()
----

As in Java, `characters` in Kotlin is strongly typed, but Kotlin's clever type inference allows for shorter syntax.

Spring Data R2DBC provides the following extensions:

* Reified generics support for `DatabaseClient` and `Criteria`.
* xref:kotlin/coroutines.adoc[] extensions for `DatabaseClient`.
