This repository was archived by the owner on Jan 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
src/main/kotlin/com/wrongwrong/mapk/core Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import com.wrongwrong.mapk.annotations.KPropertyAlias
55import com.wrongwrong.mapk.annotations.KPropertyIgnore
66import kotlin.reflect.KClass
77import kotlin.reflect.KFunction
8- import kotlin.reflect.KParameter
98import kotlin.reflect.KProperty1
109import kotlin.reflect.KVisibility
1110import kotlin.reflect.full.companionObjectInstance
@@ -20,16 +19,12 @@ class KMapper<T : Any>(private val function: KFunction<T>, propertyNameConverter
2019 getTarget(clazz), propertyNameConverter
2120 )
2221
23- private val parameters: Set <ParameterForMap <* >>
22+ private val parameters: Set <ParameterForMap <* >> = function.parameters
23+ .map { ParameterForMap .newInstance(it, propertyNameConverter) }
24+ .toSet()
2425
2526 init {
26- val params: List <KParameter > = function.parameters
27-
28- if (params.isEmpty()) throw IllegalArgumentException (" This function is not require arguments." )
29-
30- parameters = params
31- .map { ParameterForMap .newInstance(it, propertyNameConverter) }
32- .toSet()
27+ if (parameters.isEmpty()) throw IllegalArgumentException (" This function is not require arguments." )
3328
3429 // private関数に対してもマッピングできなければ何かと不都合があるため、accessibleは書き換える
3530 function.isAccessible = true
You can’t perform that action at this time.
0 commit comments