Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 9136068

Browse files
committed
ゲッターにエイリアスを設定する
1 parent 04d45e1 commit 9136068

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,20 @@ val parameterNameConverter: (String) -> String = { fieldName: String ->
507507
}
508508
val mapper: KMapper<Dst> = KMapper(::Dst, parameterNameConverter)
509509
```
510+
511+
#### Set an alias for the getter
512+
It is best to use the `KGetterAlias` annotation to rename the `_foo` field of the `Scr` class only at mapping time in the following code.
513+
514+
```kotlin
515+
data class Dst(val foo: Int)
516+
data class Src(val _foo: Int)
517+
```
518+
519+
The actual grant is as follows.
520+
521+
```kotlin
522+
data class Src(
523+
@get:KGetterAlias("foo")
524+
val _foo: Int
525+
)
526+
```

0 commit comments

Comments
 (0)