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

Commit cd989eb

Browse files
committed
改名
1 parent 20d736d commit cd989eb

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/main/kotlin/com/wrongwrong/mapk/annotations/PropertyAlias.kt renamed to src/main/kotlin/com/wrongwrong/mapk/annotations/KPropertyAlias.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package com.wrongwrong.mapk.annotations
22

33
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY_GETTER)
44
@Retention(AnnotationRetention.RUNTIME)
5-
annotation class PropertyAlias(val value: String)
5+
annotation class KPropertyAlias(val value: String)

src/main/kotlin/com/wrongwrong/mapk/annotations/PropertyIgnore.kt renamed to src/main/kotlin/com/wrongwrong/mapk/annotations/KPropertyIgnore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ package com.wrongwrong.mapk.annotations
33
@Target(AnnotationTarget.PROPERTY)
44
@Retention(AnnotationRetention.RUNTIME)
55
@MustBeDocumented
6-
annotation class PropertyIgnore
6+
annotation class KPropertyIgnore

src/main/kotlin/com/wrongwrong/mapk/core/KMapper.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.wrongwrong.mapk.core
22

33
import com.wrongwrong.mapk.annotations.KConstructor
4-
import com.wrongwrong.mapk.annotations.PropertyAlias
5-
import com.wrongwrong.mapk.annotations.PropertyIgnore
4+
import com.wrongwrong.mapk.annotations.KPropertyAlias
5+
import com.wrongwrong.mapk.annotations.KPropertyIgnore
66
import kotlin.reflect.KClass
77
import kotlin.reflect.KFunction
88
import kotlin.reflect.KParameter
@@ -44,8 +44,8 @@ class KMapper<T: Any>(private val function: KFunction<T>, propertyNameConverter:
4444
val getter = property.getter
4545

4646
val key = getter.annotations
47-
.find { it is PropertyAlias }
48-
?.let { (it as PropertyAlias).value }
47+
.find { it is KPropertyAlias }
48+
?.let { (it as KPropertyAlias).value }
4949
?: property.name
5050

5151
key to getter
@@ -72,8 +72,8 @@ class KMapper<T: Any>(private val function: KFunction<T>, propertyNameConverter:
7272
val getter = property.getter
7373

7474
val key = getter.annotations
75-
.find { it is PropertyAlias }
76-
?.let { (it as PropertyAlias).value }
75+
.find { it is KPropertyAlias }
76+
?.let { (it as KPropertyAlias).value }
7777
?: property.name
7878

7979
key to { getter.call(arg) }
@@ -106,7 +106,7 @@ private fun <T : Any> getTarget(clazz: KClass<T>): KFunction<T> {
106106

107107
private fun Collection<KProperty1<*, *>>.filterTargets(): Collection<KProperty1<*, *>> {
108108
return filter {
109-
it.visibility == KVisibility.PUBLIC && it.annotations.none { annotation -> annotation is PropertyIgnore }
109+
it.visibility == KVisibility.PUBLIC && it.annotations.none { annotation -> annotation is KPropertyIgnore }
110110
}
111111
}
112112

src/main/kotlin/com/wrongwrong/mapk/core/ParameterForMap.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.wrongwrong.mapk.core
22

3-
import com.wrongwrong.mapk.annotations.PropertyAlias
3+
import com.wrongwrong.mapk.annotations.KPropertyAlias
44
import com.wrongwrong.mapk.annotations.KConverter
55
import kotlin.reflect.KClass
66
import kotlin.reflect.KFunction
@@ -13,8 +13,8 @@ import kotlin.reflect.full.staticFunctions
1313
internal class ParameterForMap(val param: KParameter, propertyNameConverter: (String) -> String) {
1414
val clazz: KClass<*> = (param.type.classifier as KClass<*>)
1515
val name: String = param.annotations
16-
.find { it is PropertyAlias }
17-
?.let { (it as PropertyAlias).value }
16+
.find { it is KPropertyAlias }
17+
?.let { (it as KPropertyAlias).value }
1818
?: propertyNameConverter(param.name!!)
1919

2020
val javaClazz: Class<*> by lazy {

0 commit comments

Comments
 (0)