Skip to content

Commit e002afa

Browse files
committed
DATACMNS-1807 - Correctly tagging Kotlin code as such in the documentation.
1 parent e3e2382 commit e002afa

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
@@ -232,16 +232,16 @@ Kotlin classes are supported to be instantiated , all classes are immutable by d
232232
Consider the following `data` class `Person`:
233233

234234
====
235-
[source,java]
235+
[source,kotlin]
236236
----
237237
data class Person(val id: String, val name: String)
238238
----
239239
====
240240

241-
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:
241+
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:
242242

243243
====
244-
[source,java]
244+
[source,kotlin]
245245
----
246246
data class Person(var id: String, val name: String) {
247247
@@ -252,10 +252,10 @@ data class Person(var id: String, val name: String) {
252252
====
253253

254254
Kotlin supports parameter optionality by allowing default values to be used if a parameter is not provided.
255-
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`
255+
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`
256256

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

266266
=== Property population of Kotlin data classes
267267

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

270271
====
271-
[source,java]
272+
[source,kotlin]
272273
----
273274
data class Person(val id: String, val name: String)
274275
----
275276
====
276277

277-
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.
278+
This class is effectively immutable.
279+
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)