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

Commit 783ad92

Browse files
committed
移動のため削除
1 parent 1ad8fc2 commit 783ad92

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.mapk.kmapper
33
import com.mapk.annotations.KGetterAlias
44
import com.mapk.annotations.KGetterIgnore
55
import com.mapk.core.ArgumentBucket
6-
import com.mapk.core.EnumMapper
76
import com.mapk.core.KFunctionForCall
87
import com.mapk.core.getAliasOrName
98
import com.mapk.core.isUseDefaultArgument
@@ -13,7 +12,6 @@ import kotlin.reflect.KClass
1312
import kotlin.reflect.KFunction
1413
import kotlin.reflect.KParameter
1514
import kotlin.reflect.KVisibility
16-
import kotlin.reflect.full.isSuperclassOf
1715
import kotlin.reflect.full.memberProperties
1816
import kotlin.reflect.jvm.javaGetter
1917

@@ -110,22 +108,3 @@ class PlainKMapper<T : Any> private constructor(
110108
return function.call(bucket)
111109
}
112110
}
113-
114-
private fun <T : Any, R : Any> mapObject(param: PlainParameterForMap<R>, value: T): Any? {
115-
val valueClazz: KClass<*> = value::class
116-
117-
// パラメータに対してvalueが代入可能(同じもしくは親クラス)であればそのまま用いる
118-
if (param.clazz.isSuperclassOf(valueClazz)) return value
119-
120-
val converter: KFunction<*>? = param.getConverter(valueClazz)
121-
122-
return when {
123-
// converterに一致する組み合わせが有れば設定されていればそれを使う
124-
converter != null -> converter.call(value)
125-
// 要求された値がenumかつ元が文字列ならenum mapperでマップ
126-
param.javaClazz.isEnum && value is String -> EnumMapper.getEnum(param.clazz.java, value)
127-
// 要求されているパラメータがStringならtoStringする
128-
param.clazz == String::class -> value.toString()
129-
else -> throw IllegalArgumentException("Can not convert $valueClazz to ${param.clazz}")
130-
}
131-
}

0 commit comments

Comments
 (0)