1
2
3
4
5 package gboat2.base.bridge.util.json;
6
7 import java.io.IOException;
8 import java.util.Date;
9
10 import com.fasterxml.jackson.core.JsonParser;
11 import com.fasterxml.jackson.core.JsonProcessingException;
12 import com.fasterxml.jackson.databind.DeserializationContext;
13 import com.fasterxml.jackson.databind.JsonDeserializer;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 public class UnixTimestampDeserializer extends JsonDeserializer<Date> {
34
35 @Override
36 public Date deserialize(JsonParser jp, DeserializationContext ctxt)
37 throws IOException, JsonProcessingException {
38 return new Date(Math.round(jp.getValueAsDouble() * 1000));
39 }
40 }