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

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

There is a newer version: 3.1.6.ALL
Show newest version
/*
 * 支付宝开放平台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.MoreInfoDTO;
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;

/**
 * TemplateColumnInfoDTO
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class TemplateColumnInfoDTO {
  public static final String SERIALIZED_NAME_CODE = "code";
  @SerializedName(SERIALIZED_NAME_CODE)
  private String code;

  public static final String SERIALIZED_NAME_GROUP_TITLE = "group_title";
  @SerializedName(SERIALIZED_NAME_GROUP_TITLE)
  private String groupTitle;

  public static final String SERIALIZED_NAME_ICON_ID = "icon_id";
  @SerializedName(SERIALIZED_NAME_ICON_ID)
  private String iconId;

  public static final String SERIALIZED_NAME_MORE_INFO = "more_info";
  @SerializedName(SERIALIZED_NAME_MORE_INFO)
  private MoreInfoDTO moreInfo;

  public static final String SERIALIZED_NAME_OPERATE_TYPE = "operate_type";
  @SerializedName(SERIALIZED_NAME_OPERATE_TYPE)
  private String operateType;

  public static final String SERIALIZED_NAME_TAG = "tag";
  @SerializedName(SERIALIZED_NAME_TAG)
  private String tag;

  public static final String SERIALIZED_NAME_TITLE = "title";
  @SerializedName(SERIALIZED_NAME_TITLE)
  private String title;

  public static final String SERIALIZED_NAME_VALUE = "value";
  @SerializedName(SERIALIZED_NAME_VALUE)
  private String value;

  public TemplateColumnInfoDTO() { 
  }

  public TemplateColumnInfoDTO code(String code) {
    
    this.code = code;
    return this;
  }

   /**
   * 标准栏位:行为由支付宝统一定,同时已经分配标准Code  BALANCE:会员卡余额  POINT:积分  LEVEL:等级  TELEPHONE:联系方式  自定义栏位:行为由商户定义,自定义Code码(只要无重复)
   * @return code
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "标准栏位:行为由支付宝统一定,同时已经分配标准Code  BALANCE:会员卡余额  POINT:积分  LEVEL:等级  TELEPHONE:联系方式  自定义栏位:行为由商户定义,自定义Code码(只要无重复)")

  public String getCode() {
    return code;
  }


  public void setCode(String code) {
    this.code = code;
  }


  public TemplateColumnInfoDTO groupTitle(String groupTitle) {
    
    this.groupTitle = groupTitle;
    return this;
  }

   /**
   * 若template_style_info.column_info_layout 的值为grid,此项为宫格项所属分组标题。可空。如果需要展示该项,还需支付宝内部进行特殊配置。
   * @return groupTitle
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "若template_style_info.column_info_layout 的值为grid,此项为宫格项所属分组标题。可空。如果需要展示该项,还需支付宝内部进行特殊配置。")

  public String getGroupTitle() {
    return groupTitle;
  }


  public void setGroupTitle(String groupTitle) {
    this.groupTitle = groupTitle;
  }


  public TemplateColumnInfoDTO iconId(String iconId) {
    
    this.iconId = iconId;
    return this;
  }

   /**
   * 当template_style_info.column_info_layout 的值为grid时,此参数必填。此项为宫格项的展示icon。通过接口(alipay.offline.material.image.upload)上传图片。
   * @return iconId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "当template_style_info.column_info_layout 的值为grid时,此参数必填。此项为宫格项的展示icon。通过接口(alipay.offline.material.image.upload)上传图片。")

  public String getIconId() {
    return iconId;
  }


  public void setIconId(String iconId) {
    this.iconId = iconId;
  }


  public TemplateColumnInfoDTO moreInfo(MoreInfoDTO moreInfo) {
    
    this.moreInfo = moreInfo;
    return this;
  }

   /**
   * Get moreInfo
   * @return moreInfo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public MoreInfoDTO getMoreInfo() {
    return moreInfo;
  }


  public void setMoreInfo(MoreInfoDTO moreInfo) {
    this.moreInfo = moreInfo;
  }


  public TemplateColumnInfoDTO operateType(String operateType) {
    
    this.operateType = operateType;
    return this;
  }

   /**
   * 1、openNative:打开二级页面,展现 more中descs  2、openWeb:打开URL  3、staticinfo:静态信息  注意:  不填则默认staticinfo;  标准code尽量使用staticinfo,例如TELEPHONE商家电话栏位就只支持staticinfo;
   * @return operateType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "1、openNative:打开二级页面,展现 more中descs  2、openWeb:打开URL  3、staticinfo:静态信息  注意:  不填则默认staticinfo;  标准code尽量使用staticinfo,例如TELEPHONE商家电话栏位就只支持staticinfo;")

  public String getOperateType() {
    return operateType;
  }


  public void setOperateType(String operateType) {
    this.operateType = operateType;
  }


  public TemplateColumnInfoDTO tag(String tag) {
    
    this.tag = tag;
    return this;
  }

   /**
   * 只有当template_style_info.column_info_layout 的值为grid时,此参数有效。此项为宫格项标签,最多只会展示一个标签。
   * @return tag
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "只有当template_style_info.column_info_layout 的值为grid时,此参数有效。此项为宫格项标签,最多只会展示一个标签。")

  public String getTag() {
    return tag;
  }


  public void setTag(String tag) {
    this.tag = tag;
  }


  public TemplateColumnInfoDTO title(String title) {
    
    this.title = title;
    return this;
  }

   /**
   * 栏目标题
   * @return title
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "栏目标题")

  public String getTitle() {
    return title;
  }


  public void setTitle(String title) {
    this.title = title;
  }


  public TemplateColumnInfoDTO value(String value) {
    
    this.value = value;
    return this;
  }

   /**
   * 卡包详情页面,卡栏位右边展现的值    TELEPHONE栏位的商家联系电话号码由此value字段传入
   * @return value
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "卡包详情页面,卡栏位右边展现的值    TELEPHONE栏位的商家联系电话号码由此value字段传入")

  public String getValue() {
    return value;
  }


  public void setValue(String value) {
    this.value = value;
  }

  /**
   * 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 TemplateColumnInfoDTO instance itself
   */
  public TemplateColumnInfoDTO 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;
    }
    TemplateColumnInfoDTO templateColumnInfoDTO = (TemplateColumnInfoDTO) o;
    return Objects.equals(this.code, templateColumnInfoDTO.code) &&
        Objects.equals(this.groupTitle, templateColumnInfoDTO.groupTitle) &&
        Objects.equals(this.iconId, templateColumnInfoDTO.iconId) &&
        Objects.equals(this.moreInfo, templateColumnInfoDTO.moreInfo) &&
        Objects.equals(this.operateType, templateColumnInfoDTO.operateType) &&
        Objects.equals(this.tag, templateColumnInfoDTO.tag) &&
        Objects.equals(this.title, templateColumnInfoDTO.title) &&
        Objects.equals(this.value, templateColumnInfoDTO.value)&&
        Objects.equals(this.additionalProperties, templateColumnInfoDTO.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(code, groupTitle, iconId, moreInfo, operateType, tag, title, value, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class TemplateColumnInfoDTO {\n");
    sb.append("    code: ").append(toIndentedString(code)).append("\n");
    sb.append("    groupTitle: ").append(toIndentedString(groupTitle)).append("\n");
    sb.append("    iconId: ").append(toIndentedString(iconId)).append("\n");
    sb.append("    moreInfo: ").append(toIndentedString(moreInfo)).append("\n");
    sb.append("    operateType: ").append(toIndentedString(operateType)).append("\n");
    sb.append("    tag: ").append(toIndentedString(tag)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("    value: ").append(toIndentedString(value)).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("code");
    openapiFields.add("group_title");
    openapiFields.add("icon_id");
    openapiFields.add("more_info");
    openapiFields.add("operate_type");
    openapiFields.add("tag");
    openapiFields.add("title");
    openapiFields.add("value");

    // 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 TemplateColumnInfoDTO
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (TemplateColumnInfoDTO.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in TemplateColumnInfoDTO is not found in the empty JSON string", TemplateColumnInfoDTO.openapiRequiredFields.toString()));
        }
      }
      if (jsonObj.get("code") != null && !jsonObj.get("code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString()));
      }
      if (jsonObj.get("group_title") != null && !jsonObj.get("group_title").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `group_title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("group_title").toString()));
      }
      if (jsonObj.get("icon_id") != null && !jsonObj.get("icon_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `icon_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("icon_id").toString()));
      }
      // validate the optional field `more_info`
      if (jsonObj.getAsJsonObject("more_info") != null) {
        MoreInfoDTO.validateJsonObject(jsonObj.getAsJsonObject("more_info"));
      }
      if (jsonObj.get("operate_type") != null && !jsonObj.get("operate_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `operate_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operate_type").toString()));
      }
      if (jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString()));
      }
      if (jsonObj.get("title") != null && !jsonObj.get("title").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString()));
      }
      if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString()));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, TemplateColumnInfoDTO 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 TemplateColumnInfoDTO read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             TemplateColumnInfoDTO 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 TemplateColumnInfoDTO given an JSON string
  *
  * @param jsonString JSON string
  * @return An instance of TemplateColumnInfoDTO
  * @throws IOException if the JSON string is invalid with respect to TemplateColumnInfoDTO
  */
  public static TemplateColumnInfoDTO fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, TemplateColumnInfoDTO.class);
  }

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy