me.chanjar.weixin.mp.util.json.WxMpCardGsonAdapter Maven / Gradle / Ivy
package me.chanjar.weixin.mp.util.json;
import java.lang.reflect.Type;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.mp.bean.WxMpCard;
/**
* Created by YuJian on 15/11/11.
*
* @author YuJian
* @version 15/11/11
*/
public class WxMpCardGsonAdapter implements JsonDeserializer {
@Override
public WxMpCard deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext
jsonDeserializationContext) throws JsonParseException {
WxMpCard card = new WxMpCard();
JsonObject jsonObject = jsonElement.getAsJsonObject();
card.setCardId(GsonHelper.getString(jsonObject, "card_id"));
card.setBeginTime(GsonHelper.getLong(jsonObject, "begin_time"));
card.setEndTime(GsonHelper.getLong(jsonObject, "end_time"));
return card;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy