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

uk.gov.service.payments.commons.api.json.IsoInstantMicrosecondDeserializer Maven / Gradle / Ivy

There is a newer version: 1.0.20241120144934
Show newest version
package uk.gov.service.payments.commons.api.json;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import java.io.IOException;
import java.time.Instant;

import static uk.gov.service.payments.commons.model.CommonDateTimeFormatters.ISO_INSTANT_MICROSECOND_PRECISION;

public class IsoInstantMicrosecondDeserializer extends StdDeserializer {

    public IsoInstantMicrosecondDeserializer() {
        this(null);
    }

    private IsoInstantMicrosecondDeserializer(Class t) {
        super(t);
    }

    @Override
    public Instant deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException {
       return ISO_INSTANT_MICROSECOND_PRECISION.parse(jsonParser.getText(), Instant::from);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy