All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unzer.payment.communication.JsonDateTimeConverter Maven / Gradle / Ivy

package com.unzer.payment.communication;

import com.google.gson.*;

import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.Date;

public class JsonDateTimeConverter extends JsonDateConverter
        implements JsonDeserializer, JsonSerializer {

    @Override
    public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
        return getDate(json);
    }

    @Override
    public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
        return new JsonPrimitive(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(src));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy