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

com.mailersend.sdk.scheduledmessages.Message Maven / Gradle / Ivy

package com.mailersend.sdk.scheduledmessages;

import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Date;

import com.google.gson.annotations.SerializedName;

/**
 * 

Message class.

* * @author mailersend * @version $Id: $Id */ public class Message { @SerializedName("id") public String id; @SerializedName("created_at") private String createdAtStr; public Date createdAt; @SerializedName("updated_at") private String updatedAtStr; public Date updatedAt; /** * Is called to perform any actions after the deserialization of the response * Do not call directly */ public void postDeserialize() { parseDates(); } /** * Parses the string dates from the response into java.util.Date objects */ private void parseDates() { TemporalAccessor ta; Instant instant; if (createdAtStr != null && !createdAtStr.isBlank()) { ta = DateTimeFormatter.ISO_INSTANT.parse(createdAtStr); instant = Instant.from(ta); createdAt = Date.from(instant); } if (updatedAtStr != null && !updatedAtStr.isBlank()) { ta = DateTimeFormatter.ISO_INSTANT.parse(updatedAtStr); instant = Instant.from(ta); updatedAt = Date.from(instant); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy