info.metadude.kotlin.library.engelsystem.adapters.ZoneOffsetAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engelsystem-base Show documentation
Show all versions of engelsystem-base Show documentation
A Kotlin library containing a parser and models for the Engelsystem.
package info.metadude.kotlin.library.engelsystem.adapters
import com.squareup.moshi.FromJson
import org.threeten.bp.DateTimeException
import org.threeten.bp.ZoneOffset
class ZoneOffsetAdapter {
@FromJson
fun fromJson(jsonValue: String?) = jsonValue?.let {
try {
ZoneOffset.of(jsonValue)
} catch (e: DateTimeException) {
println(e.message)
null
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy