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

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

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


package com.alipay.v3.model;

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

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;

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

import com.alipay.v3.JSON;

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

  public static final String SERIALIZED_NAME_JSON_STRING = "json_string";
  @SerializedName(SERIALIZED_NAME_JSON_STRING)
  private String jsonString;

  public static final String SERIALIZED_NAME_OPEN_ID_LIST = "open_id_list";
  @SerializedName(SERIALIZED_NAME_OPEN_ID_LIST)
  private List openIdList = null;

  public static final String SERIALIZED_NAME_OPENID = "openid";
  @SerializedName(SERIALIZED_NAME_OPENID)
  private String openid;

  public static final String SERIALIZED_NAME_UID = "uid";
  @SerializedName(SERIALIZED_NAME_UID)
  private String uid;

  public static final String SERIALIZED_NAME_UID_LIST = "uid_list";
  @SerializedName(SERIALIZED_NAME_UID_LIST)
  private List uidList = null;

  public OpenidComplex() { 
  }

  public OpenidComplex jsonString(String jsonString) {
    
    this.jsonString = jsonString;
    return this;
  }

   /**
   * 11
   * @return jsonString
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "{}", value = "11")

  public String getJsonString() {
    return jsonString;
  }


  public void setJsonString(String jsonString) {
    this.jsonString = jsonString;
  }


  public OpenidComplex openIdList(List openIdList) {
    
    this.openIdList = openIdList;
    return this;
  }

  public OpenidComplex addOpenIdListItem(String openIdListItem) {
    if (this.openIdList == null) {
      this.openIdList = new ArrayList<>();
    }
    this.openIdList.add(openIdListItem);
    return this;
  }

   /**
   * 1
   * @return openIdList
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "[\"074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5\"]", value = "1")

  public List getOpenIdList() {
    return openIdList;
  }


  public void setOpenIdList(List openIdList) {
    this.openIdList = openIdList;
  }


  public OpenidComplex openid(String openid) {
    
    this.openid = openid;
    return this;
  }

   /**
   * 11
   * @return openid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5", value = "11")

  public String getOpenid() {
    return openid;
  }


  public void setOpenid(String openid) {
    this.openid = openid;
  }


  public OpenidComplex uid(String uid) {
    
    this.uid = uid;
    return this;
  }

   /**
   * 11
   * @return uid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2088502241306951", value = "11")

  public String getUid() {
    return uid;
  }


  public void setUid(String uid) {
    this.uid = uid;
  }


  public OpenidComplex uidList(List uidList) {
    
    this.uidList = uidList;
    return this;
  }

  public OpenidComplex addUidListItem(String uidListItem) {
    if (this.uidList == null) {
      this.uidList = new ArrayList<>();
    }
    this.uidList.add(uidListItem);
    return this;
  }

   /**
   * 1
   * @return uidList
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "[\"2088502241306951\"]", value = "1")

  public List getUidList() {
    return uidList;
  }


  public void setUidList(List uidList) {
    this.uidList = uidList;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    OpenidComplex openidComplex = (OpenidComplex) o;
    return Objects.equals(this.jsonString, openidComplex.jsonString) &&
        Objects.equals(this.openIdList, openidComplex.openIdList) &&
        Objects.equals(this.openid, openidComplex.openid) &&
        Objects.equals(this.uid, openidComplex.uid) &&
        Objects.equals(this.uidList, openidComplex.uidList);
  }

  @Override
  public int hashCode() {
    return Objects.hash(jsonString, openIdList, openid, uid, uidList);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class OpenidComplex {\n");
    sb.append("    jsonString: ").append(toIndentedString(jsonString)).append("\n");
    sb.append("    openIdList: ").append(toIndentedString(openIdList)).append("\n");
    sb.append("    openid: ").append(toIndentedString(openid)).append("\n");
    sb.append("    uid: ").append(toIndentedString(uid)).append("\n");
    sb.append("    uidList: ").append(toIndentedString(uidList)).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("json_string");
    openapiFields.add("open_id_list");
    openapiFields.add("openid");
    openapiFields.add("uid");
    openapiFields.add("uid_list");

    // 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 OpenidComplex
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (OpenidComplex.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in OpenidComplex is not found in the empty JSON string", OpenidComplex.openapiRequiredFields.toString()));
        }
      }

      Set> entries = jsonObj.entrySet();
      // check to see if the JSON string contains additional fields
      for (Entry entry : entries) {
        if (!OpenidComplex.openapiFields.contains(entry.getKey())) {
          throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenidComplex` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
        }
      }
      if (jsonObj.get("json_string") != null && !jsonObj.get("json_string").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `json_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("json_string").toString()));
      }
      // ensure the json data is an array
      if (jsonObj.get("open_id_list") != null && !jsonObj.get("open_id_list").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `open_id_list` to be an array in the JSON string but got `%s`", jsonObj.get("open_id_list").toString()));
      }
      if (jsonObj.get("openid") != null && !jsonObj.get("openid").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `openid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("openid").toString()));
      }
      if (jsonObj.get("uid") != null && !jsonObj.get("uid").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `uid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uid").toString()));
      }
      // ensure the json data is an array
      if (jsonObj.get("uid_list") != null && !jsonObj.get("uid_list").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `uid_list` to be an array in the JSON string but got `%s`", jsonObj.get("uid_list").toString()));
      }
  }

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

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

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

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy