com.github.lsqlebai.utils.UrlJsonSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-common Show documentation
Show all versions of server-common Show documentation
An kotlin server common jar
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