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

com.alipay.v3.model.OrderItem Maven / Gradle / Ivy

There is a newer version: 3.1.6.ALL
Show newest version
/*
 * 支付宝开放平台API
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2022-12-23
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.alipay.v3.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.io.Serializable;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
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 com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.alipay.v3.JSON;

/**
 * OrderItem
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class OrderItem {
  private static final long serialVersionUID = 1L;

  public static final String SERIALIZED_NAME_ADDRESS = "address";
  @SerializedName(SERIALIZED_NAME_ADDRESS)
  private String address;

  public static final String SERIALIZED_NAME_BRAND_NAME = "brand_name";
  @SerializedName(SERIALIZED_NAME_BRAND_NAME)
  private String brandName;

  public static final String SERIALIZED_NAME_CATEGORY = "category";
  @SerializedName(SERIALIZED_NAME_CATEGORY)
  private String category;

  public static final String SERIALIZED_NAME_CITY = "city";
  @SerializedName(SERIALIZED_NAME_CITY)
  private String city;

  public static final String SERIALIZED_NAME_CITY_CODE = "city_code";
  @SerializedName(SERIALIZED_NAME_CITY_CODE)
  private String cityCode;

  public static final String SERIALIZED_NAME_COMMODITY_ID = "commodity_id";
  @SerializedName(SERIALIZED_NAME_COMMODITY_ID)
  private String commodityId;

  public static final String SERIALIZED_NAME_CONTACTS = "contacts";
  @SerializedName(SERIALIZED_NAME_CONTACTS)
  private String contacts;

  public static final String SERIALIZED_NAME_CREATOR = "creator";
  @SerializedName(SERIALIZED_NAME_CREATOR)
  private String creator;

  public static final String SERIALIZED_NAME_EXPIRE_DATE = "expire_date";
  @SerializedName(SERIALIZED_NAME_EXPIRE_DATE)
  private String expireDate;

  public static final String SERIALIZED_NAME_MERCHANT_NAME = "merchant_name";
  @SerializedName(SERIALIZED_NAME_MERCHANT_NAME)
  private String merchantName;

  public static final String SERIALIZED_NAME_MERCHANT_PID = "merchant_pid";
  @SerializedName(SERIALIZED_NAME_MERCHANT_PID)
  private String merchantPid;

  public static final String SERIALIZED_NAME_MINI_APP_ID = "mini_app_id";
  @SerializedName(SERIALIZED_NAME_MINI_APP_ID)
  private String miniAppId;

  public static final String SERIALIZED_NAME_MINI_APP_NAME = "mini_app_name";
  @SerializedName(SERIALIZED_NAME_MINI_APP_NAME)
  private String miniAppName;

  public static final String SERIALIZED_NAME_ONLINE_TIME = "online_time";
  @SerializedName(SERIALIZED_NAME_ONLINE_TIME)
  private String onlineTime;

  public static final String SERIALIZED_NAME_ORDER_STATUS = "order_status";
  @SerializedName(SERIALIZED_NAME_ORDER_STATUS)
  private String orderStatus;

  public static final String SERIALIZED_NAME_PHONE_NO = "phone_no";
  @SerializedName(SERIALIZED_NAME_PHONE_NO)
  private String phoneNo;

  public static final String SERIALIZED_NAME_PROVINCE = "province";
  @SerializedName(SERIALIZED_NAME_PROVINCE)
  private String province;

  public static final String SERIALIZED_NAME_SHOP_ID = "shop_id";
  @SerializedName(SERIALIZED_NAME_SHOP_ID)
  private String shopId;

  public static final String SERIALIZED_NAME_SHOP_NAME = "shop_name";
  @SerializedName(SERIALIZED_NAME_SHOP_NAME)
  private String shopName;

  public static final String SERIALIZED_NAME_SHOP_STATUS = "shop_status";
  @SerializedName(SERIALIZED_NAME_SHOP_STATUS)
  private String shopStatus;

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private String status;

  public OrderItem() { 
  }

  public OrderItem address(String address) {
    
    this.address = address;
    return this;
  }

   /**
   * 店铺所在具体位置
   * @return address
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "西湖区XX街XX号", value = "店铺所在具体位置")

  public String getAddress() {
    return address;
  }


  public void setAddress(String address) {
    this.address = address;
  }


  public OrderItem brandName(String brandName) {
    
    this.brandName = brandName;
    return this;
  }

   /**
   * 品牌名称
   * @return brandName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "肯德基", value = "品牌名称")

  public String getBrandName() {
    return brandName;
  }


  public void setBrandName(String brandName) {
    this.brandName = brandName;
  }


  public OrderItem category(String category) {
    
    this.category = category;
    return this;
  }

   /**
   * 店铺品类
   * @return category
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "咖啡", value = "店铺品类")

  public String getCategory() {
    return category;
  }


  public void setCategory(String category) {
    this.category = category;
  }


  public OrderItem city(String city) {
    
    this.city = city;
    return this;
  }

   /**
   * 店铺所在的市
   * @return city
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "杭州市", value = "店铺所在的市")

  public String getCity() {
    return city;
  }


  public void setCity(String city) {
    this.city = city;
  }


  public OrderItem cityCode(String cityCode) {
    
    this.cityCode = cityCode;
    return this;
  }

   /**
   * 城市编码
   * @return cityCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "110100", value = "城市编码")

  public String getCityCode() {
    return cityCode;
  }


  public void setCityCode(String cityCode) {
    this.cityCode = cityCode;
  }


  public OrderItem commodityId(String commodityId) {
    
    this.commodityId = commodityId;
    return this;
  }

   /**
   * 订购的服务商品ID
   * @return commodityId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "201604290086730119", value = "订购的服务商品ID")

  public String getCommodityId() {
    return commodityId;
  }


  public void setCommodityId(String commodityId) {
    this.commodityId = commodityId;
  }


  public OrderItem contacts(String contacts) {
    
    this.contacts = contacts;
    return this;
  }

   /**
   * 订单联系人
   * @return contacts
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "张三", value = "订单联系人")

  public String getContacts() {
    return contacts;
  }


  public void setContacts(String contacts) {
    this.contacts = contacts;
  }


  public OrderItem creator(String creator) {
    
    this.creator = creator;
    return this;
  }

   /**
   * 门店创建人(已删除)
   * @return creator
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "张三", value = "门店创建人(已删除)")

  public String getCreator() {
    return creator;
  }


  public void setCreator(String creator) {
    this.creator = creator;
  }


  public OrderItem expireDate(String expireDate) {
    
    this.expireDate = expireDate;
    return this;
  }

   /**
   * 过期时间
   * @return expireDate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2016-01-01  00:00:01", value = "过期时间")

  public String getExpireDate() {
    return expireDate;
  }


  public void setExpireDate(String expireDate) {
    this.expireDate = expireDate;
  }


  public OrderItem merchantName(String merchantName) {
    
    this.merchantName = merchantName;
    return this;
  }

   /**
   * 商户名称
   * @return merchantName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "XX网络有限公司", value = "商户名称")

  public String getMerchantName() {
    return merchantName;
  }


  public void setMerchantName(String merchantName) {
    this.merchantName = merchantName;
  }


  public OrderItem merchantPid(String merchantPid) {
    
    this.merchantPid = merchantPid;
    return this;
  }

   /**
   * 商户PID
   * @return merchantPid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2088101118588888", value = "商户PID")

  public String getMerchantPid() {
    return merchantPid;
  }


  public void setMerchantPid(String merchantPid) {
    this.merchantPid = merchantPid;
  }


  public OrderItem miniAppId(String miniAppId) {
    
    this.miniAppId = miniAppId;
    return this;
  }

   /**
   * 小程序APPID,订购实体为小程序的场景该字段必填
   * @return miniAppId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2017121800945174", value = "小程序APPID,订购实体为小程序的场景该字段必填")

  public String getMiniAppId() {
    return miniAppId;
  }


  public void setMiniAppId(String miniAppId) {
    this.miniAppId = miniAppId;
  }


  public OrderItem miniAppName(String miniAppName) {
    
    this.miniAppName = miniAppName;
    return this;
  }

   /**
   * 小程序应用名称,订购实体为小程序的场景该字段必填
   * @return miniAppName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "小张火锅店小程序", value = "小程序应用名称,订购实体为小程序的场景该字段必填")

  public String getMiniAppName() {
    return miniAppName;
  }


  public void setMiniAppName(String miniAppName) {
    this.miniAppName = miniAppName;
  }


  public OrderItem onlineTime(String onlineTime) {
    
    this.onlineTime = onlineTime;
    return this;
  }

   /**
   * 上架时间
   * @return onlineTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2016-01-01 00:01:01", value = "上架时间")

  public String getOnlineTime() {
    return onlineTime;
  }


  public void setOnlineTime(String onlineTime) {
    this.onlineTime = onlineTime;
  }


  public OrderItem orderStatus(String orderStatus) {
    
    this.orderStatus = orderStatus;
    return this;
  }

   /**
   * TO_DO-未实施,DOING-实施中,TO_CONFIRM-待商户确认,CONFIRMED-商户已确认,DONE-已完成,MERCHANT_REJECTED-商户已回绝,MERCHANT_CANCELLED-商户已取消,ISV_REJECTED-服务商已回绝,ISV_CANCELLED-服务商已取消
   * @return orderStatus
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "DONE", value = "TO_DO-未实施,DOING-实施中,TO_CONFIRM-待商户确认,CONFIRMED-商户已确认,DONE-已完成,MERCHANT_REJECTED-商户已回绝,MERCHANT_CANCELLED-商户已取消,ISV_REJECTED-服务商已回绝,ISV_CANCELLED-服务商已取消")

  public String getOrderStatus() {
    return orderStatus;
  }


  public void setOrderStatus(String orderStatus) {
    this.orderStatus = orderStatus;
  }


  public OrderItem phoneNo(String phoneNo) {
    
    this.phoneNo = phoneNo;
    return this;
  }

   /**
   * 订单所属人联系方式(手机或者座机)
   * @return phoneNo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "13988888888", value = "订单所属人联系方式(手机或者座机)")

  public String getPhoneNo() {
    return phoneNo;
  }


  public void setPhoneNo(String phoneNo) {
    this.phoneNo = phoneNo;
  }


  public OrderItem province(String province) {
    
    this.province = province;
    return this;
  }

   /**
   * 店铺所在的省份
   * @return province
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "浙江省", value = "店铺所在的省份")

  public String getProvince() {
    return province;
  }


  public void setProvince(String province) {
    this.province = province;
  }


  public OrderItem shopId(String shopId) {
    
    this.shopId = shopId;
    return this;
  }

   /**
   * 店铺ID,订购实体为口碑门店的场景该字段必填
   * @return shopId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2015052000077000000000182140", value = "店铺ID,订购实体为口碑门店的场景该字段必填")

  public String getShopId() {
    return shopId;
  }


  public void setShopId(String shopId) {
    this.shopId = shopId;
  }


  public OrderItem shopName(String shopName) {
    
    this.shopName = shopName;
    return this;
  }

   /**
   * 店铺名称,订购实体为口碑门店的场景该字段必填
   * @return shopName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "小张火锅店", value = "店铺名称,订购实体为口碑门店的场景该字段必填")

  public String getShopName() {
    return shopName;
  }


  public void setShopName(String shopName) {
    this.shopName = shopName;
  }


  public OrderItem shopStatus(String shopStatus) {
    
    this.shopStatus = shopStatus;
    return this;
  }

   /**
   * 店铺状态(ONLINE--已上架 OFFLINE--未上架 AVAILABLE--已开通 INIT--未开通 EXPIRED--已过期)
   * @return shopStatus
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "ONLINE", value = "店铺状态(ONLINE--已上架 OFFLINE--未上架 AVAILABLE--已开通 INIT--未开通 EXPIRED--已过期)")

  public String getShopStatus() {
    return shopStatus;
  }


  public void setShopStatus(String shopStatus) {
    this.shopStatus = shopStatus;
  }


  public OrderItem status(String status) {
    
    this.status = status;
    return this;
  }

   /**
   * 待服务商接单
   * @return status
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "MERCHANT_ORDED---待服务商接单", value = "待服务商接单")

  public String getStatus() {
    return status;
  }


  public void setStatus(String status) {
    this.status = status;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    OrderItem orderItem = (OrderItem) o;
    return Objects.equals(this.address, orderItem.address) &&
        Objects.equals(this.brandName, orderItem.brandName) &&
        Objects.equals(this.category, orderItem.category) &&
        Objects.equals(this.city, orderItem.city) &&
        Objects.equals(this.cityCode, orderItem.cityCode) &&
        Objects.equals(this.commodityId, orderItem.commodityId) &&
        Objects.equals(this.contacts, orderItem.contacts) &&
        Objects.equals(this.creator, orderItem.creator) &&
        Objects.equals(this.expireDate, orderItem.expireDate) &&
        Objects.equals(this.merchantName, orderItem.merchantName) &&
        Objects.equals(this.merchantPid, orderItem.merchantPid) &&
        Objects.equals(this.miniAppId, orderItem.miniAppId) &&
        Objects.equals(this.miniAppName, orderItem.miniAppName) &&
        Objects.equals(this.onlineTime, orderItem.onlineTime) &&
        Objects.equals(this.orderStatus, orderItem.orderStatus) &&
        Objects.equals(this.phoneNo, orderItem.phoneNo) &&
        Objects.equals(this.province, orderItem.province) &&
        Objects.equals(this.shopId, orderItem.shopId) &&
        Objects.equals(this.shopName, orderItem.shopName) &&
        Objects.equals(this.shopStatus, orderItem.shopStatus) &&
        Objects.equals(this.status, orderItem.status);
  }

  @Override
  public int hashCode() {
    return Objects.hash(address, brandName, category, city, cityCode, commodityId, contacts, creator, expireDate, merchantName, merchantPid, miniAppId, miniAppName, onlineTime, orderStatus, phoneNo, province, shopId, shopName, shopStatus, status);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class OrderItem {\n");
    sb.append("    address: ").append(toIndentedString(address)).append("\n");
    sb.append("    brandName: ").append(toIndentedString(brandName)).append("\n");
    sb.append("    category: ").append(toIndentedString(category)).append("\n");
    sb.append("    city: ").append(toIndentedString(city)).append("\n");
    sb.append("    cityCode: ").append(toIndentedString(cityCode)).append("\n");
    sb.append("    commodityId: ").append(toIndentedString(commodityId)).append("\n");
    sb.append("    contacts: ").append(toIndentedString(contacts)).append("\n");
    sb.append("    creator: ").append(toIndentedString(creator)).append("\n");
    sb.append("    expireDate: ").append(toIndentedString(expireDate)).append("\n");
    sb.append("    merchantName: ").append(toIndentedString(merchantName)).append("\n");
    sb.append("    merchantPid: ").append(toIndentedString(merchantPid)).append("\n");
    sb.append("    miniAppId: ").append(toIndentedString(miniAppId)).append("\n");
    sb.append("    miniAppName: ").append(toIndentedString(miniAppName)).append("\n");
    sb.append("    onlineTime: ").append(toIndentedString(onlineTime)).append("\n");
    sb.append("    orderStatus: ").append(toIndentedString(orderStatus)).append("\n");
    sb.append("    phoneNo: ").append(toIndentedString(phoneNo)).append("\n");
    sb.append("    province: ").append(toIndentedString(province)).append("\n");
    sb.append("    shopId: ").append(toIndentedString(shopId)).append("\n");
    sb.append("    shopName: ").append(toIndentedString(shopName)).append("\n");
    sb.append("    shopStatus: ").append(toIndentedString(shopStatus)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }


  public static HashSet openapiFields;
  public static HashSet openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet();
    openapiFields.add("address");
    openapiFields.add("brand_name");
    openapiFields.add("category");
    openapiFields.add("city");
    openapiFields.add("city_code");
    openapiFields.add("commodity_id");
    openapiFields.add("contacts");
    openapiFields.add("creator");
    openapiFields.add("expire_date");
    openapiFields.add("merchant_name");
    openapiFields.add("merchant_pid");
    openapiFields.add("mini_app_id");
    openapiFields.add("mini_app_name");
    openapiFields.add("online_time");
    openapiFields.add("order_status");
    openapiFields.add("phone_no");
    openapiFields.add("province");
    openapiFields.add("shop_id");
    openapiFields.add("shop_name");
    openapiFields.add("shop_status");
    openapiFields.add("status");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

 /**
  * Validates the JSON Object and throws an exception if issues found
  *
  * @param jsonObj JSON Object
  * @throws IOException if the JSON Object is invalid with respect to OrderItem
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (OrderItem.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in OrderItem is not found in the empty JSON string", OrderItem.openapiRequiredFields.toString()));
        }
      }

      Set> entries = jsonObj.entrySet();
      // check to see if the JSON string contains additional fields
      for (Entry entry : entries) {
        if (!OrderItem.openapiFields.contains(entry.getKey())) {
          throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderItem` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
        }
      }
      if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString()));
      }
      if (jsonObj.get("brand_name") != null && !jsonObj.get("brand_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `brand_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brand_name").toString()));
      }
      if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("category").toString()));
      }
      if (jsonObj.get("city") != null && !jsonObj.get("city").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString()));
      }
      if (jsonObj.get("city_code") != null && !jsonObj.get("city_code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `city_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city_code").toString()));
      }
      if (jsonObj.get("commodity_id") != null && !jsonObj.get("commodity_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `commodity_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commodity_id").toString()));
      }
      if (jsonObj.get("contacts") != null && !jsonObj.get("contacts").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `contacts` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contacts").toString()));
      }
      if (jsonObj.get("creator") != null && !jsonObj.get("creator").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `creator` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creator").toString()));
      }
      if (jsonObj.get("expire_date") != null && !jsonObj.get("expire_date").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `expire_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expire_date").toString()));
      }
      if (jsonObj.get("merchant_name") != null && !jsonObj.get("merchant_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `merchant_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("merchant_name").toString()));
      }
      if (jsonObj.get("merchant_pid") != null && !jsonObj.get("merchant_pid").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `merchant_pid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("merchant_pid").toString()));
      }
      if (jsonObj.get("mini_app_id") != null && !jsonObj.get("mini_app_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `mini_app_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mini_app_id").toString()));
      }
      if (jsonObj.get("mini_app_name") != null && !jsonObj.get("mini_app_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `mini_app_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mini_app_name").toString()));
      }
      if (jsonObj.get("online_time") != null && !jsonObj.get("online_time").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `online_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("online_time").toString()));
      }
      if (jsonObj.get("order_status") != null && !jsonObj.get("order_status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `order_status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("order_status").toString()));
      }
      if (jsonObj.get("phone_no") != null && !jsonObj.get("phone_no").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `phone_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone_no").toString()));
      }
      if (jsonObj.get("province") != null && !jsonObj.get("province").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `province` to be a primitive type in the JSON string but got `%s`", jsonObj.get("province").toString()));
      }
      if (jsonObj.get("shop_id") != null && !jsonObj.get("shop_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `shop_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shop_id").toString()));
      }
      if (jsonObj.get("shop_name") != null && !jsonObj.get("shop_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `shop_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shop_name").toString()));
      }
      if (jsonObj.get("shop_status") != null && !jsonObj.get("shop_status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `shop_status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shop_status").toString()));
      }
      if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!OrderItem.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'OrderItem' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(OrderItem.class));

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, OrderItem value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             elementAdapter.write(out, obj);
           }

           @Override
           public OrderItem read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             return thisAdapter.fromJsonTree(jsonObj);
           }

       }.nullSafe();
    }
  }

 /**
  * Create an instance of OrderItem given an JSON string
  *
  * @param jsonString JSON string
  * @return An instance of OrderItem
  * @throws IOException if the JSON string is invalid with respect to OrderItem
  */
  public static OrderItem fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, OrderItem.class);
  }

 /**
  * Convert an instance of OrderItem to an JSON string
  *
  * @return JSON string
  */
  public String toJson() {
    return JSON.getGson().toJson(this);
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy