Skip to content

Commit a58b168

Browse files
authored
Update doc_for_extensions.md
1 parent f67c2e3 commit a58b168

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

doc_for_extensions.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Customize your own plugin by these steps, and you will have your own plugin, in
1414

1515
![image](https://user-images.githubusercontent.com/9211902/51250876-ccb8cb00-19d2-11e9-9620-9c45c8975bfa.png)
1616

17-
Package name could be your own domain name. in this case we will you `wu.seal`
17+
Package name could be your own domain name. in this case we will use `wu.seal`
1818

1919
5. Create a Extension object class file under your created package
2020

@@ -75,13 +75,16 @@ Customize your own plugin by these steps, and you will have your own plugin, in
7575
10. And make the properties names to be all upper case
7676

7777
```kotlin
78-
override fun intercept(kotlinDataClass: KotlinDataClass): KotlinDataClass {
78+
override fun intercept(kotlinDataClass: KotlinDataClass): KotlinDataClass {
7979

80+
return if (getConfig(configKey).toBoolean()) {
8081
//make all properties name to be all upper case
8182
val newProperties = kotlinDataClass.properties.map { it.copy(name = it.name.toUpperCase()) }
82-
83-
return kotlinDataClass.copy(properties = newProperties)
83+
kotlinDataClass.copy(properties = newProperties)
84+
} else {
85+
kotlinDataClass
8486
}
87+
}
8588
```
8689

8790
We use `map`method to create a new properties which all properties names are translate to be all upper case, And copy the incoming parameter `kotlinDataClass` with replacing the new created properties, and return it to the system.

0 commit comments

Comments
 (0)