com.github.twitch4j.common.util.MilliInstantDeserializer Maven / Gradle / Ivy
package com.github.twitch4j.common.util;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
import java.time.DateTimeException;
import java.time.Instant;
public class MilliInstantDeserializer extends JsonDeserializer {
@Override
public Instant deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, DateTimeException, ArithmeticException {
return Instant.ofEpochMilli(p.getValueAsLong());
}
}