This repository was archived by the owner on Jan 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-12
lines changed
src/main/kotlin/com/mapk/kmapper Expand file tree Collapse file tree 2 files changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import com.mapk.core.EnumMapper
44import kotlin.reflect.KClass
55import kotlin.reflect.KFunction
66import kotlin.reflect.KParameter
7- import kotlin.reflect.full.isSubclassOf
87import kotlin.reflect.full.isSuperclassOf
98
109internal class ParameterForMap <T : Any > private constructor(val param : KParameter , private val clazz : KClass <T >) {
@@ -28,7 +27,7 @@ internal class ParameterForMap<T : Any> private constructor(val param: KParamete
2827 return value
2928 }
3029
31- val converter: KFunction <* >? = getConverter(valueClazz)
30+ val converter: KFunction <* >? = converters. getConverter(valueClazz)
3231
3332 val lambda: (Any ) -> Any? = when {
3433 // converterに一致する組み合わせが有れば設定されていればそれを使う
@@ -43,10 +42,6 @@ internal class ParameterForMap<T : Any> private constructor(val param: KParamete
4342 return lambda(value)
4443 }
4544
46- // 引数の型がconverterに対して入力可能ならconverterを返す
47- private fun <R : Any > getConverter (input : KClass <out R >): KFunction <T >? =
48- converters.find { (key, _) -> input.isSubclassOf(key) }?.second
49-
5045 companion object {
5146 fun newInstance (param : KParameter ): ParameterForMap <* > {
5247 return ParameterForMap (param, param.type.classifier as KClass <* >)
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import com.mapk.core.EnumMapper
44import kotlin.reflect.KClass
55import kotlin.reflect.KFunction
66import kotlin.reflect.KParameter
7- import kotlin.reflect.full.isSubclassOf
87import kotlin.reflect.full.isSuperclassOf
98
109internal class PlainParameterForMap <T : Any > private constructor(val param : KParameter , private val clazz : KClass <T >) {
@@ -20,7 +19,7 @@ internal class PlainParameterForMap<T : Any> private constructor(val param: KPar
2019 // パラメータに対してvalueが代入可能(同じもしくは親クラス)であればそのまま用いる
2120 if (clazz.isSuperclassOf(valueClazz)) return value
2221
23- val converter: KFunction <* >? = getConverter(valueClazz)
22+ val converter: KFunction <* >? = converters. getConverter(valueClazz)
2423
2524 return when {
2625 // converterに一致する組み合わせが有れば設定されていればそれを使う
@@ -33,10 +32,6 @@ internal class PlainParameterForMap<T : Any> private constructor(val param: KPar
3332 }
3433 }
3534
36- // 引数の型がconverterに対して入力可能ならconverterを返す
37- private fun <R : Any > getConverter (input : KClass <out R >): KFunction <T >? =
38- converters.find { (key, _) -> input.isSubclassOf(key) }?.second
39-
4035 companion object {
4136 fun newInstance (param : KParameter ): PlainParameterForMap <* > {
4237 return PlainParameterForMap (param, param.type.classifier as KClass <* >)
You can’t perform that action at this time.
0 commit comments