content: /*
   * 支付宝开放平台API
   * 支付宝开放平台v3协议文档
   *
   * The version of the OpenAPI document: 2025-08-26
   * 
   *
   * 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.AccessParams;
  import com.alipay.v3.model.OpenApiSpecifiedChannelParamsPojo;
  import com.alipay.v3.model.PeriodRuleParams;
  import com.alipay.v3.model.SignMerchantParams;
  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;
  
  /**
   * SignParams
   */
  @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
  public class SignParams {
    public static final String SERIALIZED_NAME_ACCESS_PARAMS = "access_params";
    @SerializedName(SERIALIZED_NAME_ACCESS_PARAMS)
    private AccessParams accessParams;
  
    public static final String SERIALIZED_NAME_ALLOW_HUAZHI_DEGRADE = "allow_huazhi_degrade";
    @SerializedName(SERIALIZED_NAME_ALLOW_HUAZHI_DEGRADE)
    private Boolean allowHuazhiDegrade;
  
    public static final String SERIALIZED_NAME_EFFECT_TIME = "effect_time";
    @SerializedName(SERIALIZED_NAME_EFFECT_TIME)
    private String effectTime;
  
    public static final String SERIALIZED_NAME_EXTERNAL_AGREEMENT_NO = "external_agreement_no";
    @SerializedName(SERIALIZED_NAME_EXTERNAL_AGREEMENT_NO)
    private String externalAgreementNo;
  
    public static final String SERIALIZED_NAME_EXTERNAL_LOGON_ID = "external_logon_id";
    @SerializedName(SERIALIZED_NAME_EXTERNAL_LOGON_ID)
    private String externalLogonId;
  
    public static final String SERIALIZED_NAME_PERIOD_RULE_PARAMS = "period_rule_params";
    @SerializedName(SERIALIZED_NAME_PERIOD_RULE_PARAMS)
    private PeriodRuleParams periodRuleParams;
  
    public static final String SERIALIZED_NAME_PERSONAL_PRODUCT_CODE = "personal_product_code";
    @SerializedName(SERIALIZED_NAME_PERSONAL_PRODUCT_CODE)
    private String personalProductCode;
  
    public static final String SERIALIZED_NAME_PRODUCT_CODE = "product_code";
    @SerializedName(SERIALIZED_NAME_PRODUCT_CODE)
    private String productCode;
  
    public static final String SERIALIZED_NAME_RECOMMEND_SORT_CHANNEL_PARAMS = "recommend_sort_channel_params";
    @SerializedName(SERIALIZED_NAME_RECOMMEND_SORT_CHANNEL_PARAMS)
    private List<OpenApiSpecifiedChannelParamsPojo> recommendSortChannelParams = null;
  
    public static final String SERIALIZED_NAME_SIGN_NOTIFY_URL = "sign_notify_url";
    @SerializedName(SERIALIZED_NAME_SIGN_NOTIFY_URL)
    private String signNotifyUrl;
  
    public static final String SERIALIZED_NAME_SIGN_SCENE = "sign_scene";
    @SerializedName(SERIALIZED_NAME_SIGN_SCENE)
    private String signScene;
  
    public static final String SERIALIZED_NAME_SUB_MERCHANT = "sub_merchant";
    @SerializedName(SERIALIZED_NAME_SUB_MERCHANT)
    private SignMerchantParams subMerchant;
  
    public SignParams() { 
    }
  
    public SignParams accessParams(AccessParams accessParams) {
      
      this.accessParams = accessParams;
      return this;
    }
  
     /**
     * Get accessParams
     * @return accessParams
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
  
    public AccessParams getAccessParams() {
      return accessParams;
    }
  
  
    public void setAccessParams(AccessParams accessParams) {
      this.accessParams = accessParams;
    }
  
  
    public SignParams allowHuazhiDegrade(Boolean allowHuazhiDegrade) {
      
      this.allowHuazhiDegrade = allowHuazhiDegrade;
      return this;
    }
  
     /**
     * 是否允许花芝GO降级成原代扣（即销售方案指定的代扣产品），在花芝GO场景下才会使用该值。取值：true-允许降级，false-不允许降级。默认为true。
     * @return allowHuazhiDegrade
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "false", value = "是否允许花芝GO降级成原代扣（即销售方案指定的代扣产品），在花芝GO场景下才会使用该值。取值：true-允许降级，false-不允许降级。默认为true。")
  
    public Boolean getAllowHuazhiDegrade() {
      return allowHuazhiDegrade;
    }
  
  
    public void setAllowHuazhiDegrade(Boolean allowHuazhiDegrade) {
      this.allowHuazhiDegrade = allowHuazhiDegrade;
    }
  
  
    public SignParams effectTime(String effectTime) {
      
      this.effectTime = effectTime;
      return this;
    }
  
     /**
     * 设置签约请求的有效时间，单位为秒。如传入600，商户发起签约请求到用户进入支付宝签约页面的时间差不能超过10分钟。
     * @return effectTime
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "600", value = "设置签约请求的有效时间，单位为秒。如传入600，商户发起签约请求到用户进入支付宝签约页面的时间差不能超过10分钟。")
  
    public String getEffectTime() {
      return effectTime;
    }
  
  
    public void setEffectTime(String effectTime) {
      this.effectTime = effectTime;
    }
  
  
    public SignParams externalAgreementNo(String externalAgreementNo) {
      
      this.externalAgreementNo = externalAgreementNo;
      return this;
    }
  
     /**
     * 商户签约号，代扣协议中标示用户的唯一签约号（确保在商户系统中唯一）。 格式规则：支持大写小写字母和数字，最长32位。 商户系统按需传入，如果同一用户在同一产品码、同一签约场景下，签订了多份代扣协议，那么需要指定并传入该值。
     * @return externalAgreementNo
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "test20190701", value = "商户签约号，代扣协议中标示用户的唯一签约号（确保在商户系统中唯一）。 格式规则：支持大写小写字母和数字，最长32位。 商户系统按需传入，如果同一用户在同一产品码、同一签约场景下，签订了多份代扣协议，那么需要指定并传入该值。")
  
    public String getExternalAgreementNo() {
      return externalAgreementNo;
    }
  
  
    public void setExternalAgreementNo(String externalAgreementNo) {
      this.externalAgreementNo = externalAgreementNo;
    }
  
  
    public SignParams externalLogonId(String externalLogonId) {
      
      this.externalLogonId = externalLogonId;
      return this;
    }
  
     /**
     * 用户在商户网站的登录账号，用于在签约页面展示，如果为空，则不展示
     * @return externalLogonId
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "13888888888", value = "用户在商户网站的登录账号，用于在签约页面展示，如果为空，则不展示")
  
    public String getExternalLogonId() {
      return externalLogonId;
    }
  
  
    public void setExternalLogonId(String externalLogonId) {
      this.externalLogonId = externalLogonId;
    }
  
  
    public SignParams periodRuleParams(PeriodRuleParams periodRuleParams) {
      
      this.periodRuleParams = periodRuleParams;
      return this;
    }
  
     /**
     * Get periodRuleParams
     * @return periodRuleParams
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
  
    public PeriodRuleParams getPeriodRuleParams() {
      return periodRuleParams;
    }
  
  
    public void setPeriodRuleParams(PeriodRuleParams periodRuleParams) {
      this.periodRuleParams = periodRuleParams;
    }
  
  
    public SignParams personalProductCode(String personalProductCode) {
      
      this.personalProductCode = personalProductCode;
      return this;
    }
  
     /**
     * 个人签约产品码，商户和支付宝签约时确定。
     * @return personalProductCode
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "CYCLE_PAY_AUTH_P", value = "个人签约产品码，商户和支付宝签约时确定。")
  
    public String getPersonalProductCode() {
      return personalProductCode;
    }
  
  
    public void setPersonalProductCode(String personalProductCode) {
      this.personalProductCode = personalProductCode;
    }
  
  
    public SignParams productCode(String productCode) {
      
      this.productCode = productCode;
      return this;
    }
  
     /**
     * 商家和支付宝签约的产品码。 商家扣款产品传入固定值：GENERAL_WITHHOLDING
     * @return productCode
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "GENERAL_WITHHOLDING", value = "商家和支付宝签约的产品码。 商家扣款产品传入固定值：GENERAL_WITHHOLDING")
  
    public String getProductCode() {
      return productCode;
    }
  
  
    public void setProductCode(String productCode) {
      this.productCode = productCode;
    }
  
  
    public SignParams recommendSortChannelParams(List<OpenApiSpecifiedChannelParamsPojo> recommendSortChannelParams) {
      
      this.recommendSortChannelParams = recommendSortChannelParams;
      return this;
    }
  
    public SignParams addRecommendSortChannelParamsItem(OpenApiSpecifiedChannelParamsPojo recommendSortChannelParamsItem) {
      if (this.recommendSortChannelParams == null) {
        this.recommendSortChannelParams = new ArrayList<>();
      }
      this.recommendSortChannelParams.add(recommendSortChannelParamsItem);
      return this;
    }
  
     /**
     * 商户指定优先渠道扣款参数
     * @return recommendSortChannelParams
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "商户指定优先渠道扣款参数")
  
    public List<OpenApiSpecifiedChannelParamsPojo> getRecommendSortChannelParams() {
      return recommendSortChannelParams;
    }
  
  
    public void setRecommendSortChannelParams(List<OpenApiSpecifiedChannelParamsPojo> recommendSortChannelParams) {
      this.recommendSortChannelParams = recommendSortChannelParams;
    }
  
  
    public SignParams signNotifyUrl(String signNotifyUrl) {
      
      this.signNotifyUrl = signNotifyUrl;
      return this;
    }
  
     /**
     * 签约成功后商户用于接收异步通知的地址。如果不传入，签约与支付的异步通知都会发到外层notify_url参数传入的地址；如果外层也未传入，签约与支付的异步通知都会发到商户appid配置的网关地址。
     * @return signNotifyUrl
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "http://www.merchant.com/receiveSignNotify", value = "签约成功后商户用于接收异步通知的地址。如果不传入，签约与支付的异步通知都会发到外层notify_url参数传入的地址；如果外层也未传入，签约与支付的异步通知都会发到商户appid配置的网关地址。")
  
    public String getSignNotifyUrl() {
      return signNotifyUrl;
    }
  
  
    public void setSignNotifyUrl(String signNotifyUrl) {
      this.signNotifyUrl = signNotifyUrl;
    }
  
  
    public SignParams signScene(String signScene) {
      
      this.signScene = signScene;
      return this;
    }
  
     /**
     * 协议签约场景，商户和支付宝签约时确定，商户可咨询技术支持。
     * @return signScene
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "INDUSTRY|DIGITAL_MEDIA", value = "协议签约场景，商户和支付宝签约时确定，商户可咨询技术支持。")
  
    public String getSignScene() {
      return signScene;
    }
  
  
    public void setSignScene(String signScene) {
      this.signScene = signScene;
    }
  
  
    public SignParams subMerchant(SignMerchantParams subMerchant) {
      
      this.subMerchant = subMerchant;
      return this;
    }
  
     /**
     * Get subMerchant
     * @return subMerchant
    **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
  
    public SignMerchantParams getSubMerchant() {
      return subMerchant;
    }
  
  
    public void setSubMerchant(SignMerchantParams subMerchant) {
      this.subMerchant = subMerchant;
    }
  
    /**
     * 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<String, Object> 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 SignParams instance itself
     */
    public SignParams putAdditionalProperty(String key, Object value) {
      if (this.additionalProperties == null) {
          this.additionalProperties = new HashMap<String, Object>();
      }
      this.additionalProperties.put(key, value);
      return this;
    }
  
    /**
     * Return the additional (undeclared) property.
     *
     * @return a map of objects
     */
    public Map<String, Object> 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;
      }
      SignParams signParams = (SignParams) o;
      return Objects.equals(this.accessParams, signParams.accessParams) &&
          Objects.equals(this.allowHuazhiDegrade, signParams.allowHuazhiDegrade) &&
          Objects.equals(this.effectTime, signParams.effectTime) &&
          Objects.equals(this.externalAgreementNo, signParams.externalAgreementNo) &&
          Objects.equals(this.externalLogonId, signParams.externalLogonId) &&
          Objects.equals(this.periodRuleParams, signParams.periodRuleParams) &&
          Objects.equals(this.personalProductCode, signParams.personalProductCode) &&
          Objects.equals(this.productCode, signParams.productCode) &&
          Objects.equals(this.recommendSortChannelParams, signParams.recommendSortChannelParams) &&
          Objects.equals(this.signNotifyUrl, signParams.signNotifyUrl) &&
          Objects.equals(this.signScene, signParams.signScene) &&
          Objects.equals(this.subMerchant, signParams.subMerchant)&&
          Objects.equals(this.additionalProperties, signParams.additionalProperties);
    }
  
    @Override
    public int hashCode() {
      return Objects.hash(accessParams, allowHuazhiDegrade, effectTime, externalAgreementNo, externalLogonId, periodRuleParams, personalProductCode, productCode, recommendSortChannelParams, signNotifyUrl, signScene, subMerchant, additionalProperties);
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class SignParams {\n");
      sb.append("    accessParams: ").append(toIndentedString(accessParams)).append("\n");
      sb.append("    allowHuazhiDegrade: ").append(toIndentedString(allowHuazhiDegrade)).append("\n");
      sb.append("    effectTime: ").append(toIndentedString(effectTime)).append("\n");
      sb.append("    externalAgreementNo: ").append(toIndentedString(externalAgreementNo)).append("\n");
      sb.append("    externalLogonId: ").append(toIndentedString(externalLogonId)).append("\n");
      sb.append("    periodRuleParams: ").append(toIndentedString(periodRuleParams)).append("\n");
      sb.append("    personalProductCode: ").append(toIndentedString(personalProductCode)).append("\n");
      sb.append("    productCode: ").append(toIndentedString(productCode)).append("\n");
      sb.append("    recommendSortChannelParams: ").append(toIndentedString(recommendSortChannelParams)).append("\n");
      sb.append("    signNotifyUrl: ").append(toIndentedString(signNotifyUrl)).append("\n");
      sb.append("    signScene: ").append(toIndentedString(signScene)).append("\n");
      sb.append("    subMerchant: ").append(toIndentedString(subMerchant)).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<String> openapiFields;
    public static HashSet<String> openapiRequiredFields;
  
    static {
      // a set of all properties/fields (JSON key names)
      openapiFields = new HashSet<String>();
      openapiFields.add("access_params");
      openapiFields.add("allow_huazhi_degrade");
      openapiFields.add("effect_time");
      openapiFields.add("external_agreement_no");
      openapiFields.add("external_logon_id");
      openapiFields.add("period_rule_params");
      openapiFields.add("personal_product_code");
      openapiFields.add("product_code");
      openapiFields.add("recommend_sort_channel_params");
      openapiFields.add("sign_notify_url");
      openapiFields.add("sign_scene");
      openapiFields.add("sub_merchant");
  
      // a set of required properties/fields (JSON key names)
      openapiRequiredFields = new HashSet<String>();
    }
  
   /**
    * 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 SignParams
    */
    public static void validateJsonObject(JsonObject jsonObj) throws IOException {
        if (jsonObj == null) {
          if (SignParams.openapiRequiredFields.isEmpty()) {
            return;
          } else { // has required fields
            throw new IllegalArgumentException(String.format("The required field(s) %s in SignParams is not found in the empty JSON string", SignParams.openapiRequiredFields.toString()));
          }
        }
        // validate the optional field `access_params`
        if (jsonObj.getAsJsonObject("access_params") != null) {
          AccessParams.validateJsonObject(jsonObj.getAsJsonObject("access_params"));
        }
        if (jsonObj.get("effect_time") != null && !jsonObj.get("effect_time").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `effect_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("effect_time").toString()));
        }
        if (jsonObj.get("external_agreement_no") != null && !jsonObj.get("external_agreement_no").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `external_agreement_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("external_agreement_no").toString()));
        }
        if (jsonObj.get("external_logon_id") != null && !jsonObj.get("external_logon_id").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `external_logon_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("external_logon_id").toString()));
        }
        // validate the optional field `period_rule_params`
        if (jsonObj.getAsJsonObject("period_rule_params") != null) {
          PeriodRuleParams.validateJsonObject(jsonObj.getAsJsonObject("period_rule_params"));
        }
        if (jsonObj.get("personal_product_code") != null && !jsonObj.get("personal_product_code").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `personal_product_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("personal_product_code").toString()));
        }
        if (jsonObj.get("product_code") != null && !jsonObj.get("product_code").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `product_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("product_code").toString()));
        }
        JsonArray jsonArrayrecommendSortChannelParams = jsonObj.getAsJsonArray("recommend_sort_channel_params");
        if (jsonArrayrecommendSortChannelParams != null) {
          // ensure the json data is an array
          if (!jsonObj.get("recommend_sort_channel_params").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `recommend_sort_channel_params` to be an array in the JSON string but got `%s`", jsonObj.get("recommend_sort_channel_params").toString()));
          }
  
          // validate the optional field `recommend_sort_channel_params` (array)
          for (int i = 0; i < jsonArrayrecommendSortChannelParams.size(); i++) {
            OpenApiSpecifiedChannelParamsPojo.validateJsonObject(jsonArrayrecommendSortChannelParams.get(i).getAsJsonObject());
          };
        }
        if (jsonObj.get("sign_notify_url") != null && !jsonObj.get("sign_notify_url").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `sign_notify_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sign_notify_url").toString()));
        }
        if (jsonObj.get("sign_scene") != null && !jsonObj.get("sign_scene").isJsonPrimitive()) {
          throw new IllegalArgumentException(String.format("Expected the field `sign_scene` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sign_scene").toString()));
        }
        // validate the optional field `sub_merchant`
        if (jsonObj.getAsJsonObject("sub_merchant") != null) {
          SignMerchantParams.validateJsonObject(jsonObj.getAsJsonObject("sub_merchant"));
        }
    }
  
    public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
      @SuppressWarnings("unchecked")
      @Override
      public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
         if (!SignParams.class.isAssignableFrom(type.getRawType())) {
           return null; // this class only serializes 'SignParams' and its subtypes
         }
         final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
         final TypeAdapter<SignParams> thisAdapter
                          = gson.getDelegateAdapter(this, TypeToken.get(SignParams.class));
  
         return (TypeAdapter<T>) new TypeAdapter<SignParams>() {
             @Override
             public void write(JsonWriter out, SignParams value) throws IOException {
               JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
               obj.remove("additionalProperties");
               // serialize additonal properties
               if (value.getAdditionalProperties() != null) {
                 for (Map.Entry<String, Object> 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 SignParams read(JsonReader in) throws IOException {
               JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
               validateJsonObject(jsonObj);
               // store additional fields in the deserialized instance
               SignParams instance = thisAdapter.fromJsonTree(jsonObj);
               for (Map.Entry<String, JsonElement> 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 SignParams given an JSON string
    *
    * @param jsonString JSON string
    * @return An instance of SignParams
    * @throws IOException if the JSON string is invalid with respect to SignParams
    */
    public static SignParams fromJson(String jsonString) throws IOException {
      return JSON.getGson().fromJson(jsonString, SignParams.class);
    }
  
   /**
    * Convert an instance of SignParams to an JSON string
    *
    * @return JSON string
    */
    public String toJson() {
      return JSON.getGson().toJson(this);
    }
  }
  
  