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

com.github.lsqlebai.utils.UrlJsonSerializer.kt Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
package com.github.lsqlebai.utils

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.JsonSerializer
import com.fasterxml.jackson.databind.SerializerProvider
import com.github.lsqlebai.ServerConfig


class UrlJsonSerializer : JsonSerializer() {

    override fun serialize(value: String, gen: JsonGenerator, serializers: SerializerProvider) {
        if (!value.startsWith("http") && value.isNotBlank()) {
            gen.writeString("${ServerConfig.getStaticURL()}/$value")
        } else {
            gen.writeString(value)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy