diff options
author | Torsten Grote <t@grobox.de> | 2020-08-05 15:49:18 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-08-05 15:49:18 -0300 |
commit | 78096abeb8ca000e3480e98d300bec86350f9d13 (patch) | |
tree | 28d697cf0f248b58eed419c353e1b2f29def40ad /taler-kotlin-android/src/main | |
parent | b1acd03f70a33f069a321c6755943421330d2d8d (diff) | |
download | taler-android-78096abeb8ca000e3480e98d300bec86350f9d13.tar.gz taler-android-78096abeb8ca000e3480e98d300bec86350f9d13.tar.bz2 taler-android-78096abeb8ca000e3480e98d300bec86350f9d13.zip |
[wallet] support Timestamp with "never"
Diffstat (limited to 'taler-kotlin-android/src/main')
-rw-r--r-- | taler-kotlin-android/src/main/java/net/taler/common/TimestampMixin.kt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/taler-kotlin-android/src/main/java/net/taler/common/TimestampMixin.kt b/taler-kotlin-android/src/main/java/net/taler/common/TimestampMixin.kt index 28dbe7f..6c1bebf 100644 --- a/taler-kotlin-android/src/main/java/net/taler/common/TimestampMixin.kt +++ b/taler-kotlin-android/src/main/java/net/taler/common/TimestampMixin.kt @@ -17,11 +17,23 @@ package net.taler.common import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.deser.std.StdDeserializer /** * Used to support Jackson serialization along with KotlinX. */ abstract class TimestampMixin( + @get:JsonDeserialize(using = NeverDeserializer::class) @get:JsonProperty("t_ms") val ms: Long ) + +class NeverDeserializer : StdDeserializer<Long>(Long::class.java) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Long { + return if (p.text == "never") -1 + else p.longValue + } +} |