Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.alipay.v3.model.ZhimaCreditPeZmgoCumulationSyncModel Maven / Gradle / Ivy
/*
* 支付宝开放平台API
* 支付宝开放平台v3协议文档
*
* The version of the OpenAPI document: 2024-01-12
*
*
* 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.AmountTypeData;
import com.alipay.v3.model.TaskTypeData;
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 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;
/**
* ZhimaCreditPeZmgoCumulationSyncModel
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ZhimaCreditPeZmgoCumulationSyncModel {
public static final String SERIALIZED_NAME_AGREEMENT_NO = "agreement_no";
@SerializedName(SERIALIZED_NAME_AGREEMENT_NO)
private String agreementNo;
public static final String SERIALIZED_NAME_AMOUNT_TYPE_DATA = "amount_type_data";
@SerializedName(SERIALIZED_NAME_AMOUNT_TYPE_DATA)
private AmountTypeData amountTypeData;
public static final String SERIALIZED_NAME_BIZ_ACTION = "biz_action";
@SerializedName(SERIALIZED_NAME_BIZ_ACTION)
private String bizAction;
public static final String SERIALIZED_NAME_BIZ_TIME = "biz_time";
@SerializedName(SERIALIZED_NAME_BIZ_TIME)
private String bizTime;
public static final String SERIALIZED_NAME_CUMULATE_DATA_TYPE = "cumulate_data_type";
@SerializedName(SERIALIZED_NAME_CUMULATE_DATA_TYPE)
private String cumulateDataType;
public static final String SERIALIZED_NAME_EXT_INFO = "ext_info";
@SerializedName(SERIALIZED_NAME_EXT_INFO)
private String extInfo;
public static final String SERIALIZED_NAME_HAS_ALIPAY_TRADE = "has_alipay_trade";
@SerializedName(SERIALIZED_NAME_HAS_ALIPAY_TRADE)
private Boolean hasAlipayTrade;
public static final String SERIALIZED_NAME_OPEN_ID = "open_id";
@SerializedName(SERIALIZED_NAME_OPEN_ID)
private String openId;
public static final String SERIALIZED_NAME_OUT_BIZ_NO = "out_biz_no";
@SerializedName(SERIALIZED_NAME_OUT_BIZ_NO)
private String outBizNo;
public static final String SERIALIZED_NAME_PARTNER_ID = "partner_id";
@SerializedName(SERIALIZED_NAME_PARTNER_ID)
private String partnerId;
public static final String SERIALIZED_NAME_PAY_OUT_BIZ_NO = "pay_out_biz_no";
@SerializedName(SERIALIZED_NAME_PAY_OUT_BIZ_NO)
private String payOutBizNo;
public static final String SERIALIZED_NAME_REQUEST_FROM = "request_from";
@SerializedName(SERIALIZED_NAME_REQUEST_FROM)
private String requestFrom;
public static final String SERIALIZED_NAME_TASK_TYPE_DATA = "task_type_data";
@SerializedName(SERIALIZED_NAME_TASK_TYPE_DATA)
private TaskTypeData taskTypeData;
public static final String SERIALIZED_NAME_USER_ID = "user_id";
@SerializedName(SERIALIZED_NAME_USER_ID)
private String userId;
public ZhimaCreditPeZmgoCumulationSyncModel() {
}
public ZhimaCreditPeZmgoCumulationSyncModel agreementNo(String agreementNo) {
this.agreementNo = agreementNo;
return this;
}
/**
* 芝麻go协议号,唯一标识一个芝麻go协议。为必传入参。
* @return agreementNo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "20195108518085620000", value = "芝麻go协议号,唯一标识一个芝麻go协议。为必传入参。")
public String getAgreementNo() {
return agreementNo;
}
public void setAgreementNo(String agreementNo) {
this.agreementNo = agreementNo;
}
public ZhimaCreditPeZmgoCumulationSyncModel amountTypeData(AmountTypeData amountTypeData) {
this.amountTypeData = amountTypeData;
return this;
}
/**
* Get amountTypeData
* @return amountTypeData
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public AmountTypeData getAmountTypeData() {
return amountTypeData;
}
public void setAmountTypeData(AmountTypeData amountTypeData) {
this.amountTypeData = amountTypeData;
}
public ZhimaCreditPeZmgoCumulationSyncModel bizAction(String bizAction) {
this.bizAction = bizAction;
return this;
}
/**
* 数据回传的动作类型,为枚举值,为必传入参。 可取值: (\"ORDER_PAID\", \"正向支付\"),(\"ORDER_REFUND\", \"逆向退款\")。 其中ORDER_PAID表示回传为正向的,即订单金额累加,优惠累加,任务次数累加;而ORDER_REFUND表示回传为逆向的,即订单金额退款,优惠退款,任务次数回退。
* @return bizAction
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "ORDER_PAID", value = "数据回传的动作类型,为枚举值,为必传入参。 可取值: (\"ORDER_PAID\", \"正向支付\"),(\"ORDER_REFUND\", \"逆向退款\")。 其中ORDER_PAID表示回传为正向的,即订单金额累加,优惠累加,任务次数累加;而ORDER_REFUND表示回传为逆向的,即订单金额退款,优惠退款,任务次数回退。")
public String getBizAction() {
return bizAction;
}
public void setBizAction(String bizAction) {
this.bizAction = bizAction;
}
public ZhimaCreditPeZmgoCumulationSyncModel bizTime(String bizTime) {
this.bizTime = bizTime;
return this;
}
/**
* 交易发生时间,包括:订单交易时间,优惠核销时间,以及任务完成时间。为必传入参。 如:用户在【2019-03-08 00:00:00】核销了一个红包,但是【2019-03-10 00:00:00】才进行数据回传,此时biz_time取值红包核销的时间,也就是【2019-03-08 00:00:00】。
* @return bizTime
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2019-03-08 19:51:35", value = "交易发生时间,包括:订单交易时间,优惠核销时间,以及任务完成时间。为必传入参。 如:用户在【2019-03-08 00:00:00】核销了一个红包,但是【2019-03-10 00:00:00】才进行数据回传,此时biz_time取值红包核销的时间,也就是【2019-03-08 00:00:00】。")
public String getBizTime() {
return bizTime;
}
public void setBizTime(String bizTime) {
this.bizTime = bizTime;
}
public ZhimaCreditPeZmgoCumulationSyncModel cumulateDataType(String cumulateDataType) {
this.cumulateDataType = cumulateDataType;
return this;
}
/**
* 累计类型。为枚举值,为必传入参。 可取值:(\"AMOUNT\", \"金额类型\"),(\"TASK\", \"任务类型\"),(\"AMOUNT_TASK\", \"额度和任务类型\")。 其中,交易解耦模式仅允许AMOUNT或TASK。而交易绑定模式下,仅允许AMOUNT_TASK。
* @return cumulateDataType
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "AMOUNT", value = "累计类型。为枚举值,为必传入参。 可取值:(\"AMOUNT\", \"金额类型\"),(\"TASK\", \"任务类型\"),(\"AMOUNT_TASK\", \"额度和任务类型\")。 其中,交易解耦模式仅允许AMOUNT或TASK。而交易绑定模式下,仅允许AMOUNT_TASK。")
public String getCumulateDataType() {
return cumulateDataType;
}
public void setCumulateDataType(String cumulateDataType) {
this.cumulateDataType = cumulateDataType;
}
public ZhimaCreditPeZmgoCumulationSyncModel extInfo(String extInfo) {
this.extInfo = extInfo;
return this;
}
/**
* 扩展字段,格式为Json格式的字符串,非必传。
* @return extInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "{\"number\":\"20200303938282939\"}", value = "扩展字段,格式为Json格式的字符串,非必传。")
public String getExtInfo() {
return extInfo;
}
public void setExtInfo(String extInfo) {
this.extInfo = extInfo;
}
public ZhimaCreditPeZmgoCumulationSyncModel hasAlipayTrade(Boolean hasAlipayTrade) {
this.hasAlipayTrade = hasAlipayTrade;
return this;
}
/**
* 是否为支付宝交易。仅在累计模式为【交易绑定模式】下被消费。当芝麻Go模板配置的累计模式为交易绑定模式时,此时需传入扩展参数是否为支付宝交易。若是支付宝交易,传值true,否则为false。若不传此字段,默认为false。 若为true,则会对交易号trade_no进行校验,校验是否为支付宝交易,以及用户userId和商户partnerId是否一致,若校验不通过,累计失败。
* @return hasAlipayTrade
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "false", value = "是否为支付宝交易。仅在累计模式为【交易绑定模式】下被消费。当芝麻Go模板配置的累计模式为交易绑定模式时,此时需传入扩展参数是否为支付宝交易。若是支付宝交易,传值true,否则为false。若不传此字段,默认为false。 若为true,则会对交易号trade_no进行校验,校验是否为支付宝交易,以及用户userId和商户partnerId是否一致,若校验不通过,累计失败。")
public Boolean getHasAlipayTrade() {
return hasAlipayTrade;
}
public void setHasAlipayTrade(Boolean hasAlipayTrade) {
this.hasAlipayTrade = hasAlipayTrade;
}
public ZhimaCreditPeZmgoCumulationSyncModel openId(String openId) {
this.openId = openId;
return this;
}
/**
* 用户userId,蚂蚁统一会员ID,为必传入参。
* @return openId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5", value = "用户userId,蚂蚁统一会员ID,为必传入参。")
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public ZhimaCreditPeZmgoCumulationSyncModel outBizNo(String outBizNo) {
this.outBizNo = outBizNo;
return this;
}
/**
* 外部业务号。需保证唯一,为必传入参。 若接口调用失败,提示信息为更换幂等号,商户更换此字段重新发起调用。
* @return outBizNo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2020081211223006150094012926289", value = "外部业务号。需保证唯一,为必传入参。 若接口调用失败,提示信息为更换幂等号,商户更换此字段重新发起调用。")
public String getOutBizNo() {
return outBizNo;
}
public void setOutBizNo(String outBizNo) {
this.outBizNo = outBizNo;
}
public ZhimaCreditPeZmgoCumulationSyncModel partnerId(String partnerId) {
this.partnerId = partnerId;
return this;
}
/**
* 商户ID,为必传入参。
* @return partnerId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2088621805983504", value = "商户ID,为必传入参。")
public String getPartnerId() {
return partnerId;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
public ZhimaCreditPeZmgoCumulationSyncModel payOutBizNo(String payOutBizNo) {
this.payOutBizNo = payOutBizNo;
return this;
}
/**
* 逆向对应的正向外部业务号。逆向场景为必传入参。也就是biz_action为ORDER_REFUND时为必传入参。 逆向时需通过此字段明确对应的正向的外部业务号。
* @return payOutBizNo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2020081211223006150094012926289", value = "逆向对应的正向外部业务号。逆向场景为必传入参。也就是biz_action为ORDER_REFUND时为必传入参。 逆向时需通过此字段明确对应的正向的外部业务号。")
public String getPayOutBizNo() {
return payOutBizNo;
}
public void setPayOutBizNo(String payOutBizNo) {
this.payOutBizNo = payOutBizNo;
}
public ZhimaCreditPeZmgoCumulationSyncModel requestFrom(String requestFrom) {
this.requestFrom = requestFrom;
return this;
}
/**
* 取固定值ExternalMerchantSource,为必传入参。表示数据回传来源为外部商户,数据回传内部逻辑需感知。
* @return requestFrom
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "ExternalMerchantSource", value = "取固定值ExternalMerchantSource,为必传入参。表示数据回传来源为外部商户,数据回传内部逻辑需感知。")
public String getRequestFrom() {
return requestFrom;
}
public void setRequestFrom(String requestFrom) {
this.requestFrom = requestFrom;
}
public ZhimaCreditPeZmgoCumulationSyncModel taskTypeData(TaskTypeData taskTypeData) {
this.taskTypeData = taskTypeData;
return this;
}
/**
* Get taskTypeData
* @return taskTypeData
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public TaskTypeData getTaskTypeData() {
return taskTypeData;
}
public void setTaskTypeData(TaskTypeData taskTypeData) {
this.taskTypeData = taskTypeData;
}
public ZhimaCreditPeZmgoCumulationSyncModel userId(String userId) {
this.userId = userId;
return this;
}
/**
* 用户userId,蚂蚁统一会员ID,为必传入参。
* @return userId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2088602002015001", value = "用户userId,蚂蚁统一会员ID,为必传入参。")
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 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 ZhimaCreditPeZmgoCumulationSyncModel instance itself
*/
public ZhimaCreditPeZmgoCumulationSyncModel 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;
}
ZhimaCreditPeZmgoCumulationSyncModel zhimaCreditPeZmgoCumulationSyncModel = (ZhimaCreditPeZmgoCumulationSyncModel) o;
return Objects.equals(this.agreementNo, zhimaCreditPeZmgoCumulationSyncModel.agreementNo) &&
Objects.equals(this.amountTypeData, zhimaCreditPeZmgoCumulationSyncModel.amountTypeData) &&
Objects.equals(this.bizAction, zhimaCreditPeZmgoCumulationSyncModel.bizAction) &&
Objects.equals(this.bizTime, zhimaCreditPeZmgoCumulationSyncModel.bizTime) &&
Objects.equals(this.cumulateDataType, zhimaCreditPeZmgoCumulationSyncModel.cumulateDataType) &&
Objects.equals(this.extInfo, zhimaCreditPeZmgoCumulationSyncModel.extInfo) &&
Objects.equals(this.hasAlipayTrade, zhimaCreditPeZmgoCumulationSyncModel.hasAlipayTrade) &&
Objects.equals(this.openId, zhimaCreditPeZmgoCumulationSyncModel.openId) &&
Objects.equals(this.outBizNo, zhimaCreditPeZmgoCumulationSyncModel.outBizNo) &&
Objects.equals(this.partnerId, zhimaCreditPeZmgoCumulationSyncModel.partnerId) &&
Objects.equals(this.payOutBizNo, zhimaCreditPeZmgoCumulationSyncModel.payOutBizNo) &&
Objects.equals(this.requestFrom, zhimaCreditPeZmgoCumulationSyncModel.requestFrom) &&
Objects.equals(this.taskTypeData, zhimaCreditPeZmgoCumulationSyncModel.taskTypeData) &&
Objects.equals(this.userId, zhimaCreditPeZmgoCumulationSyncModel.userId)&&
Objects.equals(this.additionalProperties, zhimaCreditPeZmgoCumulationSyncModel.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(agreementNo, amountTypeData, bizAction, bizTime, cumulateDataType, extInfo, hasAlipayTrade, openId, outBizNo, partnerId, payOutBizNo, requestFrom, taskTypeData, userId, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ZhimaCreditPeZmgoCumulationSyncModel {\n");
sb.append(" agreementNo: ").append(toIndentedString(agreementNo)).append("\n");
sb.append(" amountTypeData: ").append(toIndentedString(amountTypeData)).append("\n");
sb.append(" bizAction: ").append(toIndentedString(bizAction)).append("\n");
sb.append(" bizTime: ").append(toIndentedString(bizTime)).append("\n");
sb.append(" cumulateDataType: ").append(toIndentedString(cumulateDataType)).append("\n");
sb.append(" extInfo: ").append(toIndentedString(extInfo)).append("\n");
sb.append(" hasAlipayTrade: ").append(toIndentedString(hasAlipayTrade)).append("\n");
sb.append(" openId: ").append(toIndentedString(openId)).append("\n");
sb.append(" outBizNo: ").append(toIndentedString(outBizNo)).append("\n");
sb.append(" partnerId: ").append(toIndentedString(partnerId)).append("\n");
sb.append(" payOutBizNo: ").append(toIndentedString(payOutBizNo)).append("\n");
sb.append(" requestFrom: ").append(toIndentedString(requestFrom)).append("\n");
sb.append(" taskTypeData: ").append(toIndentedString(taskTypeData)).append("\n");
sb.append(" userId: ").append(toIndentedString(userId)).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("agreement_no");
openapiFields.add("amount_type_data");
openapiFields.add("biz_action");
openapiFields.add("biz_time");
openapiFields.add("cumulate_data_type");
openapiFields.add("ext_info");
openapiFields.add("has_alipay_trade");
openapiFields.add("open_id");
openapiFields.add("out_biz_no");
openapiFields.add("partner_id");
openapiFields.add("pay_out_biz_no");
openapiFields.add("request_from");
openapiFields.add("task_type_data");
openapiFields.add("user_id");
// 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 ZhimaCreditPeZmgoCumulationSyncModel
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (ZhimaCreditPeZmgoCumulationSyncModel.openapiRequiredFields.isEmpty()) {
return;
} else { // has required fields
throw new IllegalArgumentException(String.format("The required field(s) %s in ZhimaCreditPeZmgoCumulationSyncModel is not found in the empty JSON string", ZhimaCreditPeZmgoCumulationSyncModel.openapiRequiredFields.toString()));
}
}
if (jsonObj.get("agreement_no") != null && !jsonObj.get("agreement_no").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `agreement_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("agreement_no").toString()));
}
// validate the optional field `amount_type_data`
if (jsonObj.getAsJsonObject("amount_type_data") != null) {
AmountTypeData.validateJsonObject(jsonObj.getAsJsonObject("amount_type_data"));
}
if (jsonObj.get("biz_action") != null && !jsonObj.get("biz_action").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `biz_action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("biz_action").toString()));
}
if (jsonObj.get("biz_time") != null && !jsonObj.get("biz_time").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `biz_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("biz_time").toString()));
}
if (jsonObj.get("cumulate_data_type") != null && !jsonObj.get("cumulate_data_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `cumulate_data_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cumulate_data_type").toString()));
}
if (jsonObj.get("ext_info") != null && !jsonObj.get("ext_info").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `ext_info` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ext_info").toString()));
}
if (jsonObj.get("open_id") != null && !jsonObj.get("open_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `open_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("open_id").toString()));
}
if (jsonObj.get("out_biz_no") != null && !jsonObj.get("out_biz_no").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `out_biz_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("out_biz_no").toString()));
}
if (jsonObj.get("partner_id") != null && !jsonObj.get("partner_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `partner_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("partner_id").toString()));
}
if (jsonObj.get("pay_out_biz_no") != null && !jsonObj.get("pay_out_biz_no").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `pay_out_biz_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pay_out_biz_no").toString()));
}
if (jsonObj.get("request_from") != null && !jsonObj.get("request_from").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `request_from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("request_from").toString()));
}
// validate the optional field `task_type_data`
if (jsonObj.getAsJsonObject("task_type_data") != null) {
TaskTypeData.validateJsonObject(jsonObj.getAsJsonObject("task_type_data"));
}
if (jsonObj.get("user_id") != null && !jsonObj.get("user_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `user_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_id").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!ZhimaCreditPeZmgoCumulationSyncModel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ZhimaCreditPeZmgoCumulationSyncModel' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ZhimaCreditPeZmgoCumulationSyncModel.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, ZhimaCreditPeZmgoCumulationSyncModel 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 ZhimaCreditPeZmgoCumulationSyncModel read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
// store additional fields in the deserialized instance
ZhimaCreditPeZmgoCumulationSyncModel 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 ZhimaCreditPeZmgoCumulationSyncModel given an JSON string
*
* @param jsonString JSON string
* @return An instance of ZhimaCreditPeZmgoCumulationSyncModel
* @throws IOException if the JSON string is invalid with respect to ZhimaCreditPeZmgoCumulationSyncModel
*/
public static ZhimaCreditPeZmgoCumulationSyncModel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ZhimaCreditPeZmgoCumulationSyncModel.class);
}
/**
* Convert an instance of ZhimaCreditPeZmgoCumulationSyncModel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}