com.blr19c.falowp.bot.system.json.LocalDateTimeDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of falowp-bot-system Show documentation
Show all versions of falowp-bot-system Show documentation
FalowpBot system infrastructure
package com.blr19c.falowp.bot.system.json
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.JsonDeserializer
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
object LocalDateTimeDeserializer : JsonDeserializer() {
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): LocalDateTime {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
return LocalDateTime.parse(p.text, formatter)
}
}