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

model.CountryJSONCodec.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.*


internal object CountryJSONCodec : AbstractJSONCodec() {

	override fun JSONDecoder.decode(valueType: JSONCodingType) =
		readString().let { code ->
			Country.byCode(code) ?: invalidValueError("'$code' is not a valid IANA country code")
		}


	override fun JSONEncoder.encode(value: Country) {
		writeString(value.code)
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy