All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fluidsonic.baku.ChangeJSONCodec.kt Maven / Gradle / Ivy

There is a newer version: 0.9.27
Show newest version
package com.github.fluidsonic.baku

import com.github.fluidsonic.fluid.json.AbstractJSONCodec
import com.github.fluidsonic.fluid.json.JSONCodingContext
import com.github.fluidsonic.fluid.json.JSONCodingType
import com.github.fluidsonic.fluid.json.JSONDecoder
import com.github.fluidsonic.fluid.json.JSONEncoder
import com.github.fluidsonic.fluid.json.readBooleanOrNull
import com.github.fluidsonic.fluid.json.readByteOrNull
import com.github.fluidsonic.fluid.json.readCharOrNull
import com.github.fluidsonic.fluid.json.readDoubleOrNull
import com.github.fluidsonic.fluid.json.readFloatOrNull
import com.github.fluidsonic.fluid.json.readIntOrNull
import com.github.fluidsonic.fluid.json.readLongOrNull
import com.github.fluidsonic.fluid.json.readShortOrNull
import com.github.fluidsonic.fluid.json.readStringOrNull
import com.github.fluidsonic.fluid.json.readValueOfType
import com.github.fluidsonic.fluid.json.readValueOfTypeOrNull
import com.github.fluidsonic.fluid.json.writeValueOrNull

internal object ChangeJSONCodec : AbstractJSONCodec, JSONCodingContext>() {
	override fun JSONDecoder.decode(valueType: JSONCodingType>): Change<*>
			= Change(value = readValueOfTypeOrNull(valueType.arguments[0]))
	override fun JSONEncoder.encode(value: Change<*>) {
		writeValueOrNull(value.value)
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy