Skip to content

Commit ab3280b

Browse files
committed
DATACMNS-1807 - Correctly tagging Kotlin code as such in the documentation.
1 parent 3a3f0be commit ab3280b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/asciidoc/object-mapping.adoc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,16 @@ Spring Data adapts specifics of Kotlin to allow object creation and mutation.
228228
Kotlin classes are supported to be instantiated , all classes are immutable by default and require explicit property declarations to define mutable properties. Consider the following `data` class `Person`:
229229

230230
====
231-
[source,java]
231+
[source,kotlin]
232232
----
233233
data class Person(val id: String, val name: String)
234234
----
235235
====
236236

237-
The class above compiles to a typical class with an explicit constructor. We can customize this class by adding another constructor and annotate it with `@PersistenceConstructor` to indicate a constructor preference:
237+
The class above compiles to a typical class with an explicit constructor.We can customize this class by adding another constructor and annotate it with `@PersistenceConstructor` to indicate a constructor preference:
238238

239239
====
240-
[source,java]
240+
[source,kotlin]
241241
----
242242
data class Person(var id: String, val name: String) {
243243
@@ -248,10 +248,10 @@ data class Person(var id: String, val name: String) {
248248
====
249249

250250
Kotlin supports parameter optionality by allowing default values to be used if a parameter is not provided.
251-
When Spring Data detects a constructor with parameter defaulting, then it leaves these parameters absent if the data store does not provide a value (or simply returns `null`) so Kotlin can apply parameter defaulting. Consider the following class that applies parameter defaulting for `name`
251+
When Spring Data detects a constructor with parameter defaulting, then it leaves these parameters absent if the data store does not provide a value (or simply returns `null`) so Kotlin can apply parameter defaulting.Consider the following class that applies parameter defaulting for `name`
252252

253253
====
254-
[source,java]
254+
[source,kotlin]
255255
----
256256
data class Person(var id: String, val name: String = "unknown")
257257
----
@@ -261,13 +261,15 @@ Every time the `name` parameter is either not part of the result or its value is
261261

262262
=== Property population of Kotlin data classes
263263

264-
In Kotlin, all classes are immutable by default and require explicit property declarations to define mutable properties. Consider the following `data` class `Person`:
264+
In Kotlin, all classes are immutable by default and require explicit property declarations to define mutable properties.
265+
Consider the following `data` class `Person`:
265266

266267
====
267-
[source,java]
268+
[source,kotlin]
268269
----
269270
data class Person(val id: String, val name: String)
270271
----
271272
====
272273

273-
This class is effectively immutable. It allows to create new instances as Kotlin generates a `copy(…)` method that creates new object instances copying all property values from the existing object and applying property values provided as arguments to the method.
274+
This class is effectively immutable.
275+
It allows creating new instances as Kotlin generates a `copy(…)` method that creates new object instances copying all property values from the existing object and applying property values provided as arguments to the method.

0 commit comments

Comments
 (0)