nl.vpro.jackson2.StringInstantToJsonTimestamp Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2016 All rights reserved
* VPRO The Netherlands
*/
package nl.vpro.jackson2;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.time.Instant;
import java.util.Optional;
import jakarta.xml.bind.DatatypeConverter;
import org.slf4j.event.Level;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import nl.vpro.logging.Slf4jHelper;
/**
* These can be used in conjunction with InstantXmlAdapter, if you want 'millis since epoch' in JSON, but formatted date stamps in xml.
* (this is what we normally do)
* @author Michiel Meeuwissen
* @since 0.39
*/
@Slf4j
public class StringInstantToJsonTimestamp {
private static boolean warnedNatty = false;
private StringInstantToJsonTimestamp() {}
public static class Serializer extends JsonSerializer