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

com.malinskiy.marathon.config.serialization.yaml.FileDeserializer.kt Maven / Gradle / Ivy

package com.malinskiy.marathon.config.serialization.yaml

import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import java.io.File
import java.nio.file.Paths

class FileDeserializer(private val marathonfileDir: File) : StdDeserializer(File::class.java) {
    override fun deserialize(p: JsonParser, ctxt: DeserializationContext): File {
        val path = Paths.get(p.valueAsString)
        return if (path.isAbsolute) {
            path.toFile()
        } else {
            File(marathonfileDir, p.valueAsString).canonicalFile
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy