com.tukeof.common.rest.gson.DateJsonDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-rest Show documentation
Show all versions of common-rest Show documentation
a encapsulated restful java library
The newest version!
package com.tukeof.common.rest.gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import java.util.Date;
/**
* Create by tuke on 2019-02-16
*/
class DateJsonDeserializer implements JsonDeserializer {
@Override
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
// format Long to Date
return new Date(json.getAsLong());
}
}