Java Code Examples for me.chanjar.weixin.common.bean.result.WxMediaUploadResult#setThumbMediaId()

The following examples show how to use me.chanjar.weixin.common.bean.result.WxMediaUploadResult#setThumbMediaId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxMediaUploadResultAdapter.java    From weixin-java-tools with Apache License 2.0 6 votes vote down vote up
@Override
public WxMediaUploadResult deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
  WxMediaUploadResult uploadResult = new WxMediaUploadResult();
  JsonObject uploadResultJsonObject = json.getAsJsonObject();

  if (uploadResultJsonObject.get("type") != null && !uploadResultJsonObject.get("type").isJsonNull()) {
    uploadResult.setType(GsonHelper.getAsString(uploadResultJsonObject.get("type")));
  }
  if (uploadResultJsonObject.get("media_id") != null && !uploadResultJsonObject.get("media_id").isJsonNull()) {
    uploadResult.setMediaId(GsonHelper.getAsString(uploadResultJsonObject.get("media_id")));
  }
  if (uploadResultJsonObject.get("thumb_media_id") != null && !uploadResultJsonObject.get("thumb_media_id").isJsonNull()) {
    uploadResult.setThumbMediaId(GsonHelper.getAsString(uploadResultJsonObject.get("thumb_media_id")));
  }
  if (uploadResultJsonObject.get("created_at") != null && !uploadResultJsonObject.get("created_at").isJsonNull()) {
    uploadResult.setCreatedAt(GsonHelper.getAsPrimitiveLong(uploadResultJsonObject.get("created_at")));
  }
  return uploadResult;
}
 
Example 2
Source File: WxMediaUploadResultAdapter.java    From weixin-java-tools with Apache License 2.0 6 votes vote down vote up
public WxMediaUploadResult deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
  WxMediaUploadResult uploadResult = new WxMediaUploadResult();
  JsonObject uploadResultJsonObject = json.getAsJsonObject();

  if (uploadResultJsonObject.get("type") != null && !uploadResultJsonObject.get("type").isJsonNull()) {
    uploadResult.setType(GsonHelper.getAsString(uploadResultJsonObject.get("type")));
  }
  if (uploadResultJsonObject.get("media_id") != null && !uploadResultJsonObject.get("media_id").isJsonNull()) {
    uploadResult.setMediaId(GsonHelper.getAsString(uploadResultJsonObject.get("media_id")));
  }
  if (uploadResultJsonObject.get("thumb_media_id") != null && !uploadResultJsonObject.get("thumb_media_id").isJsonNull()) {
    uploadResult.setThumbMediaId(GsonHelper.getAsString(uploadResultJsonObject.get("thumb_media_id")));
  }
  if (uploadResultJsonObject.get("created_at") != null && !uploadResultJsonObject.get("created_at").isJsonNull()) {
    uploadResult.setCreatedAt(GsonHelper.getAsPrimitiveLong(uploadResultJsonObject.get("created_at")));
  }
  return uploadResult;
}