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

Commit 27bfe3b

Browse files
committed
拡張関数とそれ以外とで整理
1 parent 70af196 commit 27bfe3b

File tree

1 file changed

+6
-6
lines changed
  • src/main/kotlin/com/wrongwrong/mapk/core

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class KMapper<T: Any>(private val function: KFunction<T>, propertyNameConverter:
9797
}
9898
}
9999

100+
private fun Collection<KProperty1<*, *>>.filterTargets(): Collection<KProperty1<*, *>> {
101+
return filter {
102+
it.visibility == KVisibility.PUBLIC && it.annotations.none { annotation -> annotation is KPropertyIgnore }
103+
}
104+
}
105+
100106
private fun <T : Any> getTarget(clazz: KClass<T>): KFunction<T> {
101107
val constructors: List<KFunction<T>> = clazz.constructors
102108
.filter { it.annotations.any { annotation -> annotation is KConstructor } }
@@ -108,12 +114,6 @@ private fun <T : Any> getTarget(clazz: KClass<T>): KFunction<T> {
108114
throw IllegalArgumentException("Find multiple target.")
109115
}
110116

111-
private fun Collection<KProperty1<*, *>>.filterTargets(): Collection<KProperty1<*, *>> {
112-
return filter {
113-
it.visibility == KVisibility.PUBLIC && it.annotations.none { annotation -> annotation is KPropertyIgnore }
114-
}
115-
}
116-
117117
private fun <T: Any, R: Any> mapObject(param: ParameterForMap<R>, value: T): Any? {
118118
val valueClazz: KClass<*> = value::class
119119
val creator: ((T) -> Any?)? by lazy {

0 commit comments

Comments
 (0)