com.boozallen.drift.detection.TimestampDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of foundation-drift-detection-core-java Show documentation
Show all versions of foundation-drift-detection-core-java Show documentation
The drift detection domain contains the domain objects representing what's needed to use drift detection
package com.boozallen.drift.detection;
/*-
* #%L
* Drift Detection::Domain
* %%
* Copyright (C) 2021 Booz Allen
* %%
* This software package is licensed under the Booz Allen Public License. All Rights Reserved.
* #L%
*/
import java.io.IOException;
import java.time.Instant;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
/**
* Deserializer for the drift detection result timestamp.
*/
public class TimestampDeserializer extends JsonDeserializer {
@Override
public Instant deserialize(JsonParser parser, DeserializationContext context) throws IOException {
String timestamp = parser.getText();
return Instant.parse(timestamp);
}
}