From 70fe5500c40e54c1f82fa7db8e3c419921a847ff Mon Sep 17 00:00:00 2001 From: David Denton Date: Sat, 9 Jan 2021 12:43:10 +0000 Subject: [PATCH] simplify adapter factory --- .../kotlin/org/http4k/connect/ConnectJsonAdapterFactory.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/client/src/main/kotlin/org/http4k/connect/ConnectJsonAdapterFactory.kt b/core/client/src/main/kotlin/org/http4k/connect/ConnectJsonAdapterFactory.kt index 1a72c1e3d..4bb1a8640 100644 --- a/core/client/src/main/kotlin/org/http4k/connect/ConnectJsonAdapterFactory.kt +++ b/core/client/src/main/kotlin/org/http4k/connect/ConnectJsonAdapterFactory.kt @@ -8,10 +8,8 @@ import java.lang.reflect.Type abstract class ConnectJsonAdapterFactory(vararg typesToAdapters: Pair JsonAdapter<*>>) : JsonAdapter.Factory { private val mappings = typesToAdapters.toMap() - override fun create(type: Type, annotations: Set, moshi: Moshi) = when { - annotations.isNotEmpty() -> null - else -> mappings[Types.getRawType(type).typeName]?.let { it(moshi) } - } + override fun create(type: Type, annotations: Set, moshi: Moshi) = + mappings[Types.getRawType(type).typeName]?.let { it(moshi) } } inline fun , reified K> adapter(noinline fn: (Moshi) -> T) = K::class.java.name to fn