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

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

The newest version!
/*
 * 支付宝开放平台API
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2024-08-30
 * 
 *
 * 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.alipay.v3.model.SearchBoxAppInfo;
import com.alipay.v3.model.SearchBoxServiceInfo;
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.util.ArrayList;
import java.util.List;

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;

/**
 * AlipayOpenSearchBoxConsultModel
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AlipayOpenSearchBoxConsultModel {
  public static final String SERIALIZED_NAME_AREA_KEYWORDS = "area_keywords";
  @SerializedName(SERIALIZED_NAME_AREA_KEYWORDS)
  private String areaKeywords;

  public static final String SERIALIZED_NAME_BOX_DESC = "box_desc";
  @SerializedName(SERIALIZED_NAME_BOX_DESC)
  private String boxDesc;

  public static final String SERIALIZED_NAME_BRAND_ID = "brand_id";
  @SerializedName(SERIALIZED_NAME_BRAND_ID)
  private String brandId;

  public static final String SERIALIZED_NAME_BUSINESS_BENEFIT_SWITCH = "business_benefit_switch";
  @SerializedName(SERIALIZED_NAME_BUSINESS_BENEFIT_SWITCH)
  private Boolean businessBenefitSwitch;

  public static final String SERIALIZED_NAME_BUSINESS_DISTRICT_IDS = "business_district_ids";
  @SerializedName(SERIALIZED_NAME_BUSINESS_DISTRICT_IDS)
  private List businessDistrictIds = null;

  public static final String SERIALIZED_NAME_CUSTOM_KEYWORDS = "custom_keywords";
  @SerializedName(SERIALIZED_NAME_CUSTOM_KEYWORDS)
  private List customKeywords = null;

  public static final String SERIALIZED_NAME_IMAGE_ID = "image_id";
  @SerializedName(SERIALIZED_NAME_IMAGE_ID)
  private String imageId;

  public static final String SERIALIZED_NAME_IMAGE_NAME = "image_name";
  @SerializedName(SERIALIZED_NAME_IMAGE_NAME)
  private String imageName;

  public static final String SERIALIZED_NAME_MERCHANT_ID = "merchant_id";
  @SerializedName(SERIALIZED_NAME_MERCHANT_ID)
  private String merchantId;

  public static final String SERIALIZED_NAME_RELATED_ACCOUNTS = "related_accounts";
  @SerializedName(SERIALIZED_NAME_RELATED_ACCOUNTS)
  private List relatedAccounts = null;

  public static final String SERIALIZED_NAME_SERVICE_INFOS = "service_infos";
  @SerializedName(SERIALIZED_NAME_SERVICE_INFOS)
  private List serviceInfos = null;

  public static final String SERIALIZED_NAME_TARGET_APPID = "target_appid";
  @SerializedName(SERIALIZED_NAME_TARGET_APPID)
  private String targetAppid;

  public AlipayOpenSearchBoxConsultModel() { 
  }

  public AlipayOpenSearchBoxConsultModel areaKeywords(String areaKeywords) {
    
    this.areaKeywords = areaKeywords;
    return this;
  }

   /**
   * 小程序直达配置的常用服务中带有门店信息时,可添加简称触发词
   * @return areaKeywords
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "简称触发词", value = "小程序直达配置的常用服务中带有门店信息时,可添加简称触发词")

  public String getAreaKeywords() {
    return areaKeywords;
  }


  public void setAreaKeywords(String areaKeywords) {
    this.areaKeywords = areaKeywords;
  }


  public AlipayOpenSearchBoxConsultModel boxDesc(String boxDesc) {
    
    this.boxDesc = boxDesc;
    return this;
  }

   /**
   * 品牌介绍,5-15个中文字符。  小程序直达不支持设置此项
   * @return boxDesc
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "品牌介绍", value = "品牌介绍,5-15个中文字符。  小程序直达不支持设置此项")

  public String getBoxDesc() {
    return boxDesc;
  }


  public void setBoxDesc(String boxDesc) {
    this.boxDesc = boxDesc;
  }


  public AlipayOpenSearchBoxConsultModel brandId(String brandId) {
    
    this.brandId = brandId;
    return this;
  }

   /**
   * 品牌id,参考<a href=\"https://opendocs.alipay.com/rules/029uy4\">品牌认证说明</a>
   * @return brandId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "1000467882", value = "品牌id,参考品牌认证说明")

  public String getBrandId() {
    return brandId;
  }


  public void setBrandId(String brandId) {
    this.brandId = brandId;
  }


  public AlipayOpenSearchBoxConsultModel businessBenefitSwitch(Boolean businessBenefitSwitch) {
    
    this.businessBenefitSwitch = businessBenefitSwitch;
    return this;
  }

   /**
   * 可通过配置来开启商圈权益模块,关闭后搜索直达不展示商圈权益模块
   * @return businessBenefitSwitch
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "true", value = "可通过配置来开启商圈权益模块,关闭后搜索直达不展示商圈权益模块")

  public Boolean getBusinessBenefitSwitch() {
    return businessBenefitSwitch;
  }


  public void setBusinessBenefitSwitch(Boolean businessBenefitSwitch) {
    this.businessBenefitSwitch = businessBenefitSwitch;
  }


  public AlipayOpenSearchBoxConsultModel businessDistrictIds(List businessDistrictIds) {
    
    this.businessDistrictIds = businessDistrictIds;
    return this;
  }

  public AlipayOpenSearchBoxConsultModel addBusinessDistrictIdsItem(String businessDistrictIdsItem) {
    if (this.businessDistrictIds == null) {
      this.businessDistrictIds = new ArrayList<>();
    }
    this.businessDistrictIds.add(businessDistrictIdsItem);
    return this;
  }

   /**
   * 小程序已关联商圈时,可添加商圈id(目前仅对品牌直达开放,小程序直达暂未开放)
   * @return businessDistrictIds
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "[\"商圈id\"]", value = "小程序已关联商圈时,可添加商圈id(目前仅对品牌直达开放,小程序直达暂未开放)")

  public List getBusinessDistrictIds() {
    return businessDistrictIds;
  }


  public void setBusinessDistrictIds(List businessDistrictIds) {
    this.businessDistrictIds = businessDistrictIds;
  }


  public AlipayOpenSearchBoxConsultModel customKeywords(List customKeywords) {
    
    this.customKeywords = customKeywords;
    return this;
  }

  public AlipayOpenSearchBoxConsultModel addCustomKeywordsItem(String customKeywordsItem) {
    if (this.customKeywords == null) {
      this.customKeywords = new ArrayList<>();
    }
    this.customKeywords.add(customKeywordsItem);
    return this;
  }

   /**
   * 自定义触发词,最多可配置6个,限1-8个中文字符。  小程序直达不支持设置此项
   * @return customKeywords
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "[\"自定义触发词\"]", value = "自定义触发词,最多可配置6个,限1-8个中文字符。  小程序直达不支持设置此项")

  public List getCustomKeywords() {
    return customKeywords;
  }


  public void setCustomKeywords(List customKeywords) {
    this.customKeywords = customKeywords;
  }


  public AlipayOpenSearchBoxConsultModel imageId(String imageId) {
    
    this.imageId = imageId;
    return this;
  }

   /**
   * 氛围图片id,调用 <a href=\"https://opendocs.alipay.com/mini/03hvl1?ref=api\">支付宝文件上传接口</a> 上传图片获取图片id(bizCode:search_box_atmosphere)。 <a href=\"https://opendocs.alipay.com/b/03al6f\">图片规范</a>  小程序直达不支持设置此项。
   * @return imageId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "A*oZQmT4xTBPUAAAAAAAAAAAAAAQAAAQ", value = "氛围图片id,调用 支付宝文件上传接口 上传图片获取图片id(bizCode:search_box_atmosphere)。 图片规范  小程序直达不支持设置此项。")

  public String getImageId() {
    return imageId;
  }


  public void setImageId(String imageId) {
    this.imageId = imageId;
  }


  public AlipayOpenSearchBoxConsultModel imageName(String imageName) {
    
    this.imageName = imageName;
    return this;
  }

   /**
   * 氛围图片名。  小程序直达不支持设置此项
   * @return imageName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "氛围图1", value = "氛围图片名。  小程序直达不支持设置此项")

  public String getImageName() {
    return imageName;
  }


  public void setImageName(String imageName) {
    this.imageName = imageName;
  }


  public AlipayOpenSearchBoxConsultModel merchantId(String merchantId) {
    
    this.merchantId = merchantId;
    return this;
  }

   /**
   * 商户id,代运营模式下传入。代运营模式,需要服务商已获得商家\"运营支付宝小程序\"授权。
   * @return merchantId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2088xxxxxxxxxxxx", value = "商户id,代运营模式下传入。代运营模式,需要服务商已获得商家\"运营支付宝小程序\"授权。")

  public String getMerchantId() {
    return merchantId;
  }


  public void setMerchantId(String merchantId) {
    this.merchantId = merchantId;
  }


  public AlipayOpenSearchBoxConsultModel relatedAccounts(List relatedAccounts) {
    
    this.relatedAccounts = relatedAccounts;
    return this;
  }

  public AlipayOpenSearchBoxConsultModel addRelatedAccountsItem(SearchBoxAppInfo relatedAccountsItem) {
    if (this.relatedAccounts == null) {
      this.relatedAccounts = new ArrayList<>();
    }
    this.relatedAccounts.add(relatedAccountsItem);
    return this;
  }

   /**
   * 关联账号信息,1-2个。 内部字段均需设置。
   * @return relatedAccounts
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "关联账号信息,1-2个。 内部字段均需设置。")

  public List getRelatedAccounts() {
    return relatedAccounts;
  }


  public void setRelatedAccounts(List relatedAccounts) {
    this.relatedAccounts = relatedAccounts;
  }


  public AlipayOpenSearchBoxConsultModel serviceInfos(List serviceInfos) {
    
    this.serviceInfos = serviceInfos;
    return this;
  }

  public AlipayOpenSearchBoxConsultModel addServiceInfosItem(SearchBoxServiceInfo serviceInfosItem) {
    if (this.serviceInfos == null) {
      this.serviceInfos = new ArrayList<>();
    }
    this.serviceInfos.add(serviceInfosItem);
    return this;
  }

   /**
   * 服务信息,服务必须审核通过才能申请搜索直达。 内部字段均需设置。
   * @return serviceInfos
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "服务信息,服务必须审核通过才能申请搜索直达。 内部字段均需设置。")

  public List getServiceInfos() {
    return serviceInfos;
  }


  public void setServiceInfos(List serviceInfos) {
    this.serviceInfos = serviceInfos;
  }


  public AlipayOpenSearchBoxConsultModel targetAppid(String targetAppid) {
    
    this.targetAppid = targetAppid;
    return this;
  }

   /**
   * 小程序id,小程序直达时必传,需要和申请的商户主体保持一致,且符合<a href=\"https://opendocs.alipay.com/b/03al6e\">准入类目</a>
   * @return targetAppid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2018092561XXXXXX", value = "小程序id,小程序直达时必传,需要和申请的商户主体保持一致,且符合准入类目")

  public String getTargetAppid() {
    return targetAppid;
  }


  public void setTargetAppid(String targetAppid) {
    this.targetAppid = targetAppid;
  }

  /**
   * A container for additional, undeclared properties.
   * This is a holder for any undeclared properties as specified with
   * the 'additionalProperties' keyword in the OAS document.
   */
  private Map additionalProperties;

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   *
   * @param key name of the property
   * @param value value of the property
   * @return the AlipayOpenSearchBoxConsultModel instance itself
   */
  public AlipayOpenSearchBoxConsultModel putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Return the additional (undeclared) property.
   *
   * @return a map of objects
   */
  public Map getAdditionalProperties() {
    return additionalProperties;
  }

  /**
   * Return the additional (undeclared) property with the specified name.
   *
   * @param key name of the property
   * @return an object
   */
  public Object getAdditionalProperty(String key) {
    if (this.additionalProperties == null) {
        return null;
    }
    return this.additionalProperties.get(key);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    AlipayOpenSearchBoxConsultModel alipayOpenSearchBoxConsultModel = (AlipayOpenSearchBoxConsultModel) o;
    return Objects.equals(this.areaKeywords, alipayOpenSearchBoxConsultModel.areaKeywords) &&
        Objects.equals(this.boxDesc, alipayOpenSearchBoxConsultModel.boxDesc) &&
        Objects.equals(this.brandId, alipayOpenSearchBoxConsultModel.brandId) &&
        Objects.equals(this.businessBenefitSwitch, alipayOpenSearchBoxConsultModel.businessBenefitSwitch) &&
        Objects.equals(this.businessDistrictIds, alipayOpenSearchBoxConsultModel.businessDistrictIds) &&
        Objects.equals(this.customKeywords, alipayOpenSearchBoxConsultModel.customKeywords) &&
        Objects.equals(this.imageId, alipayOpenSearchBoxConsultModel.imageId) &&
        Objects.equals(this.imageName, alipayOpenSearchBoxConsultModel.imageName) &&
        Objects.equals(this.merchantId, alipayOpenSearchBoxConsultModel.merchantId) &&
        Objects.equals(this.relatedAccounts, alipayOpenSearchBoxConsultModel.relatedAccounts) &&
        Objects.equals(this.serviceInfos, alipayOpenSearchBoxConsultModel.serviceInfos) &&
        Objects.equals(this.targetAppid, alipayOpenSearchBoxConsultModel.targetAppid)&&
        Objects.equals(this.additionalProperties, alipayOpenSearchBoxConsultModel.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(areaKeywords, boxDesc, brandId, businessBenefitSwitch, businessDistrictIds, customKeywords, imageId, imageName, merchantId, relatedAccounts, serviceInfos, targetAppid, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class AlipayOpenSearchBoxConsultModel {\n");
    sb.append("    areaKeywords: ").append(toIndentedString(areaKeywords)).append("\n");
    sb.append("    boxDesc: ").append(toIndentedString(boxDesc)).append("\n");
    sb.append("    brandId: ").append(toIndentedString(brandId)).append("\n");
    sb.append("    businessBenefitSwitch: ").append(toIndentedString(businessBenefitSwitch)).append("\n");
    sb.append("    businessDistrictIds: ").append(toIndentedString(businessDistrictIds)).append("\n");
    sb.append("    customKeywords: ").append(toIndentedString(customKeywords)).append("\n");
    sb.append("    imageId: ").append(toIndentedString(imageId)).append("\n");
    sb.append("    imageName: ").append(toIndentedString(imageName)).append("\n");
    sb.append("    merchantId: ").append(toIndentedString(merchantId)).append("\n");
    sb.append("    relatedAccounts: ").append(toIndentedString(relatedAccounts)).append("\n");
    sb.append("    serviceInfos: ").append(toIndentedString(serviceInfos)).append("\n");
    sb.append("    targetAppid: ").append(toIndentedString(targetAppid)).append("\n");
    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).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("area_keywords");
    openapiFields.add("box_desc");
    openapiFields.add("brand_id");
    openapiFields.add("business_benefit_switch");
    openapiFields.add("business_district_ids");
    openapiFields.add("custom_keywords");
    openapiFields.add("image_id");
    openapiFields.add("image_name");
    openapiFields.add("merchant_id");
    openapiFields.add("related_accounts");
    openapiFields.add("service_infos");
    openapiFields.add("target_appid");

    // 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 AlipayOpenSearchBoxConsultModel
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (AlipayOpenSearchBoxConsultModel.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in AlipayOpenSearchBoxConsultModel is not found in the empty JSON string", AlipayOpenSearchBoxConsultModel.openapiRequiredFields.toString()));
        }
      }
      if (jsonObj.get("area_keywords") != null && !jsonObj.get("area_keywords").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `area_keywords` to be a primitive type in the JSON string but got `%s`", jsonObj.get("area_keywords").toString()));
      }
      if (jsonObj.get("box_desc") != null && !jsonObj.get("box_desc").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `box_desc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("box_desc").toString()));
      }
      if (jsonObj.get("brand_id") != null && !jsonObj.get("brand_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `brand_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brand_id").toString()));
      }
      // ensure the json data is an array
      if (jsonObj.get("business_district_ids") != null && !jsonObj.get("business_district_ids").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `business_district_ids` to be an array in the JSON string but got `%s`", jsonObj.get("business_district_ids").toString()));
      }
      // ensure the json data is an array
      if (jsonObj.get("custom_keywords") != null && !jsonObj.get("custom_keywords").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `custom_keywords` to be an array in the JSON string but got `%s`", jsonObj.get("custom_keywords").toString()));
      }
      if (jsonObj.get("image_id") != null && !jsonObj.get("image_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `image_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image_id").toString()));
      }
      if (jsonObj.get("image_name") != null && !jsonObj.get("image_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `image_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image_name").toString()));
      }
      if (jsonObj.get("merchant_id") != null && !jsonObj.get("merchant_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `merchant_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("merchant_id").toString()));
      }
      JsonArray jsonArrayrelatedAccounts = jsonObj.getAsJsonArray("related_accounts");
      if (jsonArrayrelatedAccounts != null) {
        // ensure the json data is an array
        if (!jsonObj.get("related_accounts").isJsonArray()) {
          throw new IllegalArgumentException(String.format("Expected the field `related_accounts` to be an array in the JSON string but got `%s`", jsonObj.get("related_accounts").toString()));
        }

        // validate the optional field `related_accounts` (array)
        for (int i = 0; i < jsonArrayrelatedAccounts.size(); i++) {
          SearchBoxAppInfo.validateJsonObject(jsonArrayrelatedAccounts.get(i).getAsJsonObject());
        };
      }
      JsonArray jsonArrayserviceInfos = jsonObj.getAsJsonArray("service_infos");
      if (jsonArrayserviceInfos != null) {
        // ensure the json data is an array
        if (!jsonObj.get("service_infos").isJsonArray()) {
          throw new IllegalArgumentException(String.format("Expected the field `service_infos` to be an array in the JSON string but got `%s`", jsonObj.get("service_infos").toString()));
        }

        // validate the optional field `service_infos` (array)
        for (int i = 0; i < jsonArrayserviceInfos.size(); i++) {
          SearchBoxServiceInfo.validateJsonObject(jsonArrayserviceInfos.get(i).getAsJsonObject());
        };
      }
      if (jsonObj.get("target_appid") != null && !jsonObj.get("target_appid").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `target_appid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_appid").toString()));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, AlipayOpenSearchBoxConsultModel value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");
             // serialize additonal properties
             if (value.getAdditionalProperties() != null) {
               for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
                 if (entry.getValue() instanceof String)
                   obj.addProperty(entry.getKey(), (String) entry.getValue());
                 else if (entry.getValue() instanceof Number)
                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
                 else if (entry.getValue() instanceof Boolean)
                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
                 else if (entry.getValue() instanceof Character)
                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
                 else {
                   obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
                 }
               }
             }
             elementAdapter.write(out, obj);
           }

           @Override
           public AlipayOpenSearchBoxConsultModel read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             AlipayOpenSearchBoxConsultModel instance = thisAdapter.fromJsonTree(jsonObj);
             for (Map.Entry entry : jsonObj.entrySet()) {
               if (!openapiFields.contains(entry.getKey())) {
                 if (entry.getValue().isJsonPrimitive()) { // primitive type
                   if (entry.getValue().getAsJsonPrimitive().isString())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
                   else
                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
                 } else { // non-primitive type
                   instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy