codecs.basic.NonRecursiveJSONCodec.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluid-json-coding Show documentation
Show all versions of fluid-json-coding Show documentation
A JSON library written in pure Kotlin (coding extension)
package com.github.fluidsonic.fluid.json
import kotlin.reflect.*
internal abstract class NonRecursiveJSONCodec private constructor(
private val encoder: NonRecursiveJSONEncoderCodec
) :
NonRecursiveJSONDecoderCodec(),
JSONCodec,
JSONEncoderCodec by encoder {
override val encodableClass
get() = encoder.encodableClass
override fun decoderCodecForType(decodableType: JSONCodingType) =
super.decoderCodecForType(decodableType)
override fun encoderCodecForClass(encodableClass: KClass) =
encoder.encoderCodecForClass(encodableClass)
companion object {
inline fun create(): JSONCodec =
object : NonRecursiveJSONCodec(
encoder = NonRecursiveJSONEncoderCodec(encodableClass = Value::class)
) {}
}
}