All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy