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

Commit 82cb293

Browse files
committed
パラメータの生成方式を修正
コンストラクタで処理が完結するようになったため、newInstanceメソッドは削除
1 parent a9d061a commit 82cb293

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/main/kotlin/com/mapk/kmapper/PlainParameterForMap.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package com.mapk.kmapper
22

33
import com.mapk.core.EnumMapper
4+
import com.mapk.core.ValueParameter
45
import kotlin.reflect.KClass
56
import kotlin.reflect.KFunction
6-
import kotlin.reflect.KParameter
77
import kotlin.reflect.full.isSuperclassOf
88

9-
internal class PlainParameterForMap<T : Any> private constructor(
10-
val param: KParameter,
11-
private val clazz: KClass<T>,
9+
internal class PlainParameterForMap<T : Any>(
10+
param: ValueParameter<T>,
1211
private val parameterNameConverter: (String) -> String
1312
) {
13+
private val clazz: KClass<T> = param.requiredClazz
14+
1415
private val javaClazz: Class<T> by lazy {
1516
clazz.java
1617
}
@@ -38,10 +39,4 @@ internal class PlainParameterForMap<T : Any> private constructor(
3839
else -> PlainKMapper(clazz, parameterNameConverter).map(value, PARAMETER_DUMMY)
3940
}
4041
}
41-
42-
companion object {
43-
fun newInstance(param: KParameter, parameterNameConverter: (String) -> String): PlainParameterForMap<*> {
44-
return PlainParameterForMap(param, param.type.classifier as KClass<*>, parameterNameConverter)
45-
}
46-
}
4742
}

0 commit comments

Comments
 (0)