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