Skip to content

Commit f1ad03f

Browse files
committed
Add Kotlin Parent in nav
1 parent 1d56f68 commit f1ad03f

File tree

7 files changed

+37
-34
lines changed

7 files changed

+37
-34
lines changed

modules/ROOT/nav.adoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
* xref:custom-conversions.adoc[]
2020
* xref:entity-callbacks.adoc[]
2121
* xref:is-new-state-detection.adoc[]
22-
* xref:kotlin-coroutines.adoc[]
23-
* xref:kotlin-extensions.adoc[]
2422
* xref:kotlin.adoc[]
23+
** xref:kotlin/requirements.adoc[]
24+
** xref:kotlin/null-safety.adoc[]
25+
** xref:kotlin/object-mapping.adoc[]
26+
** xref:kotlin/extensions.adoc[]
27+
** xref:kotlin/coroutines.adoc[]
2528
* Appendices
2629
** xref:repository-namespace-reference.adoc[]
2730
** xref:repository-populator-namespace-reference.adoc[]

modules/ROOT/pages/kotlin.adoc

+1-32
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[[kotlin]]
22
= Kotlin Support
3+
:page-section-summary-toc: 1
34

45
https://kotlinlang.org[Kotlin] is a statically typed language that targets the JVM (and other platforms) which allows writing concise and elegant code while providing excellent https://kotlinlang.org/docs/reference/java-interop.html[interoperability] with existing libraries written in Java.
56

@@ -8,36 +9,4 @@ Spring Data provides first-class support for Kotlin and lets developers write Ko
89
The easiest way to build a Spring application with Kotlin is to leverage Spring Boot and its https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-kotlin.html[dedicated Kotlin support].
910
This comprehensive https://spring.io/guides/tutorials/spring-boot-kotlin/[tutorial] will teach you how to build Spring Boot applications with Kotlin using https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
1011

11-
[[kotlin.requirements]]
12-
== Requirements
1312

14-
Spring Data supports Kotlin 1.3 and requires `kotlin-stdlib` (or one of its variants, such as `kotlin-stdlib-jdk8`) and `kotlin-reflect` to be present on the classpath.
15-
Those are provided by default if you bootstrap a Kotlin project via https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
16-
17-
[[kotlin.null-safety]]
18-
== Null Safety
19-
20-
One of Kotlin's key features is https://kotlinlang.org/docs/null-safety.html[null safety], which cleanly deals with `null` values at compile time.
21-
This makes applications safer through nullability declarations and the expression of "`value or no value`" semantics without paying the cost of wrappers, such as `Optional`.
22-
(Kotlin allows using functional constructs with nullable values. See this https://www.baeldung.com/kotlin/null-safety[comprehensive guide to Kotlin null safety].)
23-
24-
Although Java does not let you express null safety in its type system, Spring Data API is annotated with https://jcp.org/en/jsr/detail?id=305[JSR-305] tooling friendly annotations declared in the `org.springframework.lang` package.
25-
By default, types from Java APIs used in Kotlin are recognized as https://kotlinlang.org/docs/reference/java-interop.html#null-safety-and-platform-types[platform types], for which null checks are relaxed.
26-
https://kotlinlang.org/docs/reference/java-interop.html#jsr-305-support[Kotlin support for JSR-305 annotations] and Spring nullability annotations provide null safety for the whole Spring Data API to Kotlin developers, with the advantage of dealing with `null` related issues at compile time.
27-
28-
See xref:repositories-null-handling.adoc[Null Handling of Repository Methods] how null safety applies to Spring Data Repositories.
29-
30-
[TIP]
31-
====
32-
You can configure JSR-305 checks by adding the `-Xjsr305` compiler flag with the following options: `-Xjsr305={strict|warn|ignore}`.
33-
34-
For Kotlin versions 1.1+, the default behavior is the same as `-Xjsr305=warn`.
35-
The `strict` value is required take Spring Data API null-safety into account. Kotlin types inferred from Spring API but should be used with the knowledge that Spring API nullability declaration could evolve, even between minor releases and that more checks may be added in the future.
36-
====
37-
38-
NOTE: Generic type arguments, varargs, and array elements nullability are not supported yet, but should be in an upcoming release.
39-
40-
[[kotlin.mapping]]
41-
== Object Mapping
42-
43-
See xref:object-mapping.adoc#mapping.kotlin[Kotlin support] for details on how Kotlin objects are materialized.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[[kotlin.null-safety]]
2+
= Null Safety
3+
4+
One of Kotlin's key features is https://kotlinlang.org/docs/null-safety.html[null safety], which cleanly deals with `null` values at compile time.
5+
This makes applications safer through nullability declarations and the expression of "`value or no value`" semantics without paying the cost of wrappers, such as `Optional`.
6+
(Kotlin allows using functional constructs with nullable values. See this https://www.baeldung.com/kotlin/null-safety[comprehensive guide to Kotlin null safety].)
7+
8+
Although Java does not let you express null safety in its type system, Spring Data API is annotated with https://jcp.org/en/jsr/detail?id=305[JSR-305] tooling friendly annotations declared in the `org.springframework.lang` package.
9+
By default, types from Java APIs used in Kotlin are recognized as https://kotlinlang.org/docs/reference/java-interop.html#null-safety-and-platform-types[platform types], for which null checks are relaxed.
10+
https://kotlinlang.org/docs/reference/java-interop.html#jsr-305-support[Kotlin support for JSR-305 annotations] and Spring nullability annotations provide null safety for the whole Spring Data API to Kotlin developers, with the advantage of dealing with `null` related issues at compile time.
11+
12+
See xref:repositories-null-handling.adoc[Null Handling of Repository Methods] how null safety applies to Spring Data Repositories.
13+
14+
[TIP]
15+
====
16+
You can configure JSR-305 checks by adding the `-Xjsr305` compiler flag with the following options: `-Xjsr305={strict|warn|ignore}`.
17+
18+
For Kotlin versions 1.1+, the default behavior is the same as `-Xjsr305=warn`.
19+
The `strict` value is required take Spring Data API null-safety into account. Kotlin types inferred from Spring API but should be used with the knowledge that Spring API nullability declaration could evolve, even between minor releases and that more checks may be added in the future.
20+
====
21+
22+
NOTE: Generic type arguments, varargs, and array elements nullability are not supported yet, but should be in an upcoming release.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[[kotlin.mapping]]
2+
= Object Mapping
3+
4+
See xref:object-mapping.adoc#mapping.kotlin[Kotlin support] for details on how Kotlin objects are materialized.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[[kotlin.requirements]]
2+
= Requirements
3+
4+
Spring Data supports Kotlin 1.3 and requires `kotlin-stdlib` (or one of its variants, such as `kotlin-stdlib-jdk8`) and `kotlin-reflect` to be present on the classpath.
5+
Those are provided by default if you bootstrap a Kotlin project via https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].

0 commit comments

Comments
 (0)