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

Commit 2815114

Browse files
authored
Merge pull request #7 from k163377/fix_readme
Fix readme.
2 parents 9d44947 + b201cc9 commit 2815114

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
KMapper
66
====
77
This is a Mapper Libraly like a `ModelMapper` for `Kotlin`.
8-
You can call `KFunction`(e.g. `constructor`) from `Object`.
8+
You can call `KFunction`(e.g. `method reference`) from `Object`.
99

1010
```kotlin
1111
// before
@@ -39,6 +39,8 @@ class Dst(
3939
val arg4: Double,
4040
val arg5: String?
4141
)
42+
43+
val newInstance = KMapper(::Dst).map(src1, src2, src3)
4244
```
4345

4446
### Set alias on map
@@ -47,6 +49,8 @@ class Dst(
4749
class Src(@KGetterAlias("aliased") val str: String)
4850

4951
class Dst(val aliased: String)
52+
53+
val newInstance = KMapper(::Dst).map(src)
5054
```
5155

5256
#### for parameter
@@ -56,6 +60,8 @@ class Src(val str: String)
5660
class Dst(@param:KPropertyAlias("str") private val _src: String) {
5761
val src = _src.someArrangement
5862
}
63+
64+
val newInstance = KMapper(::Dst).map(src)
5965
```
6066

6167
### Convert parameter name
@@ -64,7 +70,7 @@ val srcMap = mapOf("snake_case" to "SnakeCase")
6470

6571
class Dst(val snakeCase: String)
6672

67-
val dst: Dst = Mapper(::DataClass) { it.toSnakeCase }.map(src)
73+
val dst: Dst = KMapper(::DataClass) { camelToSnake(it) }.map(src)
6874
```
6975

7076
### Map param to another class
@@ -82,4 +88,6 @@ class CreatorClass @SingleArgCreator constructor(val arg: String) {
8288
class Src(val arg1: String, val arg2: Int)
8389

8490
class Dst(val arg1: CreatorClass, val arg2: CreatorClass)
91+
92+
val newInstance = KMapper(::Dst).map(src)
8593
```

0 commit comments

Comments
 (0)