Skip to content

Commit ede2a9c

Browse files
kevcodezfiliphr
authored andcommitted
Add note about not supported Repeatable Annotations in Kotlin
1 parent ae7ff0c commit ede2a9c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

mapstruct-kotlin/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ val personModel = converter.convertToModel(personDto)
4949
println(personModel)
5050
```
5151

52+
### Multiple Mappings
53+
54+
As of Kotlin 1.1, repeated annotations are not supported (see [KT-12794](https://youtrack.jetbrains.com/issue/KT-12794)). You have to wrap the Mapping-Annotation in a Mappings-Annotation.
55+
56+
```kotlin
57+
@Mappings(
58+
Mapping(source = "majorVersion", target = "major"),
59+
Mapping(source = "minorVersion", target = "minor"),
60+
Mapping(source = "patchVersion", target = "patch"),
61+
Mapping(source = "normalVersion", target = "normal"),
62+
Mapping(source = "preReleaseVersion", target = "preRelease")
63+
)
64+
fun convertToDto(version: Version): VersionDto
65+
```
66+
5267
## Further documentation
5368

5469
Using kapt: https://kotlinlang.org/docs/reference/kapt.html

0 commit comments

Comments
 (0)