ммм
This commit is contained in:
parent
727727b7cd
commit
ef9e22b51c
@ -44,8 +44,8 @@ private fun <T> resolveBound(bound: Class<T>, stringAdapter: TypeAdapter<String>
|
||||
}
|
||||
}
|
||||
|
||||
private class ListAdapter<T>(private val bound: Class<T>, private val stringAdapter: TypeAdapter<String>) : TypeAdapter<List<T>?>() {
|
||||
private val resolvedBound by lazy { resolveBound(bound, stringAdapter) }
|
||||
private class ListAdapter<T>(private val type: Class<T>, private val stringAdapter: TypeAdapter<String>) : TypeAdapter<List<T>?>() {
|
||||
private val resolvedBound by lazy { resolveBound(type, stringAdapter) }
|
||||
|
||||
override fun write(out: JsonWriter, value: List<T>?) {
|
||||
out.beginArray()
|
||||
@ -78,9 +78,9 @@ private class ListAdapter<T>(private val bound: Class<T>, private val stringAdap
|
||||
}
|
||||
}
|
||||
|
||||
private class MapAdapter<K, V>(private val boundKey: Class<K>, private val boundValue: Class<V>, private val stringAdapter: TypeAdapter<String>) : TypeAdapter<Map<K, V>?>() {
|
||||
private val resolvedKey by lazy { resolveBound(boundKey, stringAdapter) }
|
||||
private val resolvedValue by lazy { resolveBound(boundValue, stringAdapter) }
|
||||
private class MapAdapter<K, V>(private val keyType: Class<K>, private val valueType: Class<V>, private val stringAdapter: TypeAdapter<String>) : TypeAdapter<Map<K, V>?>() {
|
||||
private val resolvedKey by lazy { resolveBound(keyType, stringAdapter) }
|
||||
private val resolvedValue by lazy { resolveBound(valueType, stringAdapter) }
|
||||
|
||||
override fun write(out: JsonWriter, value: Map<K, V>?) {
|
||||
out.beginArray()
|
||||
@ -120,8 +120,8 @@ private class MapAdapter<K, V>(private val boundKey: Class<K>, private val bound
|
||||
}
|
||||
}
|
||||
|
||||
private class StringMapAdapter<V>(private val bound: Class<V>, private val stringAdapter: TypeAdapter<String>, private val interner: Interner<String>) : TypeAdapter<Map<String, V>?>() {
|
||||
private val resolvedBound by lazy { resolveBound(bound, stringAdapter) }
|
||||
private class StringMapAdapter<V>(private val type: Class<V>, private val stringAdapter: TypeAdapter<String>, private val interner: Interner<String>) : TypeAdapter<Map<String, V>?>() {
|
||||
private val resolvedBound by lazy { resolveBound(type, stringAdapter) }
|
||||
|
||||
override fun write(out: JsonWriter, value: Map<String, V>?) {
|
||||
val resolvedBound = resolvedBound
|
||||
@ -601,6 +601,14 @@ class KConcreteTypeAdapter<T : Any> private constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T> makeListAdapter(type: Class<T>): TypeAdapter<List<T>?> {
|
||||
return ListAdapter(type, internedStringAdapter)
|
||||
}
|
||||
|
||||
fun <T> makeObjectAdapter(type: Class<T>): TypeAdapter<Map<String, T>?> {
|
||||
return StringMapAdapter(type, internedStringAdapter, stringInterner)
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавляет поле, которое содержит список значений V (без null).
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user