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

io.github.serpro69.kfaker.blns.Mapper.kt Maven / Gradle / Ivy

package io.github.serpro69.kfaker.blns

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import java.io.InputStream

internal object Mapper {
    private val mapper = ObjectMapper()

    init {
        mapper.registerModule(KotlinModule.Builder().build())
        mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true)
        mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true)
    }

    fun  readValue(inputStream: InputStream, typeRef: TypeReference): T = mapper.readValue(inputStream, typeRef)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy