com.rapid7.container.analyzer.docker.util.InstantCustomDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docker-image-analyzer Show documentation
Show all versions of docker-image-analyzer Show documentation
Extracts, parses, and analyzes Docker images into Java objects with JSON mappings.
package com.rapid7.container.analyzer.docker.util;
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
public class InstantCustomDeserializer extends InstantDeserializer {
public static final InstantCustomDeserializer INSTANT = new InstantCustomDeserializer(Instant.class, InstantParser.INSTANT_FORMATTER);
protected InstantCustomDeserializer(Class supportedType, DateTimeFormatter formatter) {
super(supportedType, formatter, Instant::from, a -> Instant.ofEpochMilli(a.value), a -> Instant.ofEpochSecond(a.integer, a.fraction), null, true);
}
}