com.github.twitch4j.common.util.NanoInstantDeserializer 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 NanoInstantDeserializer extends JsonDeserializer {
@Override
public Instant deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, DateTimeException, ArithmeticException {
return Instant.ofEpochSecond(0, p.getValueAsLong());
}
}