001package ca.cdr.api.model.json; 002 003/* 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2026 Smile CDR, Inc. 008 * %% 009 * All rights reserved. 010 * #L% 011 */ 012 013import org.hl7.fhir.dstu3.model.InstantType; 014import tools.jackson.core.JacksonException; 015import tools.jackson.core.JsonGenerator; 016import tools.jackson.databind.SerializationContext; 017import tools.jackson.databind.ValueSerializer; 018 019import java.util.Date; 020 021public class JsonDateSerializer extends ValueSerializer<Date> { 022 023 @Override 024 public void serialize(Date theValue, JsonGenerator theGen, SerializationContext theSerializationContext) 025 throws JacksonException { 026 if (theValue != null) { 027 theGen.writeString(new InstantType(theValue).getValueAsString()); 028 } 029 } 030}