Package com.turo.pushy.apns.util
Class DateAsTimeSinceEpochTypeAdapter
- java.lang.Object
-
- com.turo.pushy.apns.util.DateAsTimeSinceEpochTypeAdapter
-
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<Date>,com.google.gson.JsonSerializer<Date>
public class DateAsTimeSinceEpochTypeAdapter extends Object implements com.google.gson.JsonSerializer<Date>, com.google.gson.JsonDeserializer<Date>
ConvertsDateinstances in JSON objects to or from timestamps since the epoch.- Author:
- Jon Chambers
-
-
Constructor Summary
Constructors Constructor Description DateAsTimeSinceEpochTypeAdapter(TimeUnit timeUnit)Constructs a new date/timestamp type adapter that uses the given time unit to measure time since the epoch.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Datedeserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)com.google.gson.JsonElementserialize(Date src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
-
-
-
Constructor Detail
-
DateAsTimeSinceEpochTypeAdapter
public DateAsTimeSinceEpochTypeAdapter(TimeUnit timeUnit)
Constructs a new date/timestamp type adapter that uses the given time unit to measure time since the epoch.- Parameters:
timeUnit- the time unit in which to express timestamps
-
-
Method Detail
-
deserialize
public Date deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
- Specified by:
deserializein interfacecom.google.gson.JsonDeserializer<Date>- Throws:
com.google.gson.JsonParseException
-
-