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

com.zuora.model.GetMassUpdateResponse Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
 * Zuora API Reference
 * REST API reference for the Zuora Billing, Payments, and Central Platform! Check out the [REST API Overview](https://www.zuora.com/developer/api-references/api/overview/).
 *
 * The version of the OpenAPI document: 2024-05-20
 * Contact: [email protected]
 *
 * 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.zuora.model;

import java.util.Objects;
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 java.io.IOException;
import java.util.Arrays;

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 com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.zuora.JSON;

/**
 * GetMassUpdateResponse
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class GetMassUpdateResponse {
  public static final String SERIALIZED_NAME_ACTION_TYPE = "actionType";
  @SerializedName(SERIALIZED_NAME_ACTION_TYPE)
  private String actionType;

  public static final String SERIALIZED_NAME_ENDED_ON = "endedOn";
  @SerializedName(SERIALIZED_NAME_ENDED_ON)
  private String endedOn;

  public static final String SERIALIZED_NAME_ERROR_COUNT = "errorCount";
  @SerializedName(SERIALIZED_NAME_ERROR_COUNT)
  private String errorCount;

  public static final String SERIALIZED_NAME_INPUT_SIZE = "inputSize";
  @SerializedName(SERIALIZED_NAME_INPUT_SIZE)
  private Long inputSize;

  public static final String SERIALIZED_NAME_OUTPUT_SIZE = "outputSize";
  @SerializedName(SERIALIZED_NAME_OUTPUT_SIZE)
  private Long outputSize;

  public static final String SERIALIZED_NAME_OUTPUT_TYPE = "outputType";
  @SerializedName(SERIALIZED_NAME_OUTPUT_TYPE)
  private String outputType;

  public static final String SERIALIZED_NAME_OUTPUT_U_R_L = "outputURL";
  @SerializedName(SERIALIZED_NAME_OUTPUT_U_R_L)
  private String outputURL;

  public static final String SERIALIZED_NAME_PROCESSED_COUNT = "processedCount";
  @SerializedName(SERIALIZED_NAME_PROCESSED_COUNT)
  private String processedCount;

  public static final String SERIALIZED_NAME_STARTED_ON = "startedOn";
  @SerializedName(SERIALIZED_NAME_STARTED_ON)
  private String startedOn;

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private String status;

  public static final String SERIALIZED_NAME_SUCCESS = "success";
  @SerializedName(SERIALIZED_NAME_SUCCESS)
  private Boolean success;

  public static final String SERIALIZED_NAME_SUCCESS_COUNT = "successCount";
  @SerializedName(SERIALIZED_NAME_SUCCESS_COUNT)
  private String successCount;

  public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount";
  @SerializedName(SERIALIZED_NAME_TOTAL_COUNT)
  private String totalCount;

  public static final String SERIALIZED_NAME_UPLOADED_BY = "uploadedBy";
  @SerializedName(SERIALIZED_NAME_UPLOADED_BY)
  private String uploadedBy;

  public static final String SERIALIZED_NAME_UPLOADED_ON = "uploadedOn";
  @SerializedName(SERIALIZED_NAME_UPLOADED_ON)
  private String uploadedOn;

  public GetMassUpdateResponse() {
  }

  public GetMassUpdateResponse actionType(String actionType) {
    this.actionType = actionType;
    return this;
  }

  /**
   * Type of mass action. 
   * @return actionType
   */
  @javax.annotation.Nullable
  public String getActionType() {
    return actionType;
  }

  public void setActionType(String actionType) {
    this.actionType = actionType;
  }


  public GetMassUpdateResponse endedOn(String endedOn) {
    this.endedOn = endedOn;
    return this;
  }

  /**
   * Date and time that the mass action was completed. The format is `yyyy-MM-dd hh:mm:ss`. 
   * @return endedOn
   */
  @javax.annotation.Nullable
  public String getEndedOn() {
    return endedOn;
  }

  public void setEndedOn(String endedOn) {
    this.endedOn = endedOn;
  }


  public GetMassUpdateResponse errorCount(String errorCount) {
    this.errorCount = errorCount;
    return this;
  }

  /**
   * Total number of failed records.  This field is updated in real time. When the mass action **status** is Processing, this field returns the number of records that have failed so far. When the mass action **status** is Pending, this field is null. 
   * @return errorCount
   */
  @javax.annotation.Nullable
  public String getErrorCount() {
    return errorCount;
  }

  public void setErrorCount(String errorCount) {
    this.errorCount = errorCount;
  }


  public GetMassUpdateResponse inputSize(Long inputSize) {
    this.inputSize = inputSize;
    return this;
  }

  /**
   * Size of the input file in bytes. 
   * @return inputSize
   */
  @javax.annotation.Nullable
  public Long getInputSize() {
    return inputSize;
  }

  public void setInputSize(Long inputSize) {
    this.inputSize = inputSize;
  }


  public GetMassUpdateResponse outputSize(Long outputSize) {
    this.outputSize = outputSize;
    return this;
  }

  /**
   * Size of the response file in bytes. 
   * @return outputSize
   */
  @javax.annotation.Nullable
  public Long getOutputSize() {
    return outputSize;
  }

  public void setOutputSize(Long outputSize) {
    this.outputSize = outputSize;
  }


  public GetMassUpdateResponse outputType(String outputType) {
    this.outputType = outputType;
    return this;
  }

  /**
   * Type of output for the response file. The following table describes the output type.  | Output Type    | Description                         | |----------------|-------------------------------------| | (url:.csv.zip) | URL pointing to a zipped .csv file. | 
   * @return outputType
   */
  @javax.annotation.Nullable
  public String getOutputType() {
    return outputType;
  }

  public void setOutputType(String outputType) {
    this.outputType = outputType;
  }


  public GetMassUpdateResponse outputURL(String outputURL) {
    this.outputURL = outputURL;
    return this;
  }

  /**
   * URL to download the response file. The response file is a zipped .csv file.  The response file is identical to the file you uploaded to perform the mass action, with additional columns providing information about the outcome of each record.  This field only returns a value when the mass action **status** is Completed or Stopped. Otherwise, this field is null. 
   * @return outputURL
   */
  @javax.annotation.Nullable
  public String getOutputURL() {
    return outputURL;
  }

  public void setOutputURL(String outputURL) {
    this.outputURL = outputURL;
  }


  public GetMassUpdateResponse processedCount(String processedCount) {
    this.processedCount = processedCount;
    return this;
  }

  /**
   * Total number of processed records. This field is equal to the sum of `errorCount` and `successCount`.  This field is updated in real time. When the mass action **status** is Processing, this field returns the number of records that have been processed so far. When the mass action **status** is Pending, this field is null. 
   * @return processedCount
   */
  @javax.annotation.Nullable
  public String getProcessedCount() {
    return processedCount;
  }

  public void setProcessedCount(String processedCount) {
    this.processedCount = processedCount;
  }


  public GetMassUpdateResponse startedOn(String startedOn) {
    this.startedOn = startedOn;
    return this;
  }

  /**
   * Date and time that Zuora started processing the mass action. The format is `yyyy-MM-dd hh:mm:ss`. 
   * @return startedOn
   */
  @javax.annotation.Nullable
  public String getStartedOn() {
    return startedOn;
  }

  public void setStartedOn(String startedOn) {
    this.startedOn = startedOn;
  }


  public GetMassUpdateResponse status(String status) {
    this.status = status;
    return this;
  }

  /**
   * Status of the mass action. The following table describes the mass action statuses.  | Status     | Description                                                                | |------------|----------------------------------------------------------------------------| | Pending    | Mass action has not yet started being processed.                           | | Processing | Mass action is in progress.                                                | | Stopping   | Mass action is in the process of stopping, but has not yet stopped.        | | Stopped    | Mass action has stopped.                                                   | | Completed  | Mass action was successfully completed. There may still be failed records. | | Failed     | Mass action failed. No records are processed. No response file is created. | 
   * @return status
   */
  @javax.annotation.Nullable
  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }


  public GetMassUpdateResponse success(Boolean success) {
    this.success = success;
    return this;
  }

  /**
   * Returns `true` if the request was processed successfully. 
   * @return success
   */
  @javax.annotation.Nullable
  public Boolean getSuccess() {
    return success;
  }

  public void setSuccess(Boolean success) {
    this.success = success;
  }


  public GetMassUpdateResponse successCount(String successCount) {
    this.successCount = successCount;
    return this;
  }

  /**
   * Total number of successful records. This field is updated in real time. When the mass action **status** is Processing, this field returns the number of records that have succeeded so far. When the mass action **status** is Pending, this field is null. 
   * @return successCount
   */
  @javax.annotation.Nullable
  public String getSuccessCount() {
    return successCount;
  }

  public void setSuccessCount(String successCount) {
    this.successCount = successCount;
  }


  public GetMassUpdateResponse totalCount(String totalCount) {
    this.totalCount = totalCount;
    return this;
  }

  /**
   * Total number of records in the uploaded mass action file. When the mass action **status** is Pending, this field is null. 
   * @return totalCount
   */
  @javax.annotation.Nullable
  public String getTotalCount() {
    return totalCount;
  }

  public void setTotalCount(String totalCount) {
    this.totalCount = totalCount;
  }


  public GetMassUpdateResponse uploadedBy(String uploadedBy) {
    this.uploadedBy = uploadedBy;
    return this;
  }

  /**
   * Email of the person who uploaded the mass action file. 
   * @return uploadedBy
   */
  @javax.annotation.Nullable
  public String getUploadedBy() {
    return uploadedBy;
  }

  public void setUploadedBy(String uploadedBy) {
    this.uploadedBy = uploadedBy;
  }


  public GetMassUpdateResponse uploadedOn(String uploadedOn) {
    this.uploadedOn = uploadedOn;
    return this;
  }

  /**
   * Date and time that the mass action file was uploaded. The format is `yyyy-MM-dd hh:mm:ss`. 
   * @return uploadedOn
   */
  @javax.annotation.Nullable
  public String getUploadedOn() {
    return uploadedOn;
  }

  public void setUploadedOn(String uploadedOn) {
    this.uploadedOn = uploadedOn;
  }

  /**
   * 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 GetMassUpdateResponse instance itself
   */
  public GetMassUpdateResponse 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;
    }
    GetMassUpdateResponse getMassUpdateResponse = (GetMassUpdateResponse) o;
    return Objects.equals(this.actionType, getMassUpdateResponse.actionType) &&
        Objects.equals(this.endedOn, getMassUpdateResponse.endedOn) &&
        Objects.equals(this.errorCount, getMassUpdateResponse.errorCount) &&
        Objects.equals(this.inputSize, getMassUpdateResponse.inputSize) &&
        Objects.equals(this.outputSize, getMassUpdateResponse.outputSize) &&
        Objects.equals(this.outputType, getMassUpdateResponse.outputType) &&
        Objects.equals(this.outputURL, getMassUpdateResponse.outputURL) &&
        Objects.equals(this.processedCount, getMassUpdateResponse.processedCount) &&
        Objects.equals(this.startedOn, getMassUpdateResponse.startedOn) &&
        Objects.equals(this.status, getMassUpdateResponse.status) &&
        Objects.equals(this.success, getMassUpdateResponse.success) &&
        Objects.equals(this.successCount, getMassUpdateResponse.successCount) &&
        Objects.equals(this.totalCount, getMassUpdateResponse.totalCount) &&
        Objects.equals(this.uploadedBy, getMassUpdateResponse.uploadedBy) &&
        Objects.equals(this.uploadedOn, getMassUpdateResponse.uploadedOn)&&
        Objects.equals(this.additionalProperties, getMassUpdateResponse.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(actionType, endedOn, errorCount, inputSize, outputSize, outputType, outputURL, processedCount, startedOn, status, success, successCount, totalCount, uploadedBy, uploadedOn, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class GetMassUpdateResponse {\n");
    sb.append("    actionType: ").append(toIndentedString(actionType)).append("\n");
    sb.append("    endedOn: ").append(toIndentedString(endedOn)).append("\n");
    sb.append("    errorCount: ").append(toIndentedString(errorCount)).append("\n");
    sb.append("    inputSize: ").append(toIndentedString(inputSize)).append("\n");
    sb.append("    outputSize: ").append(toIndentedString(outputSize)).append("\n");
    sb.append("    outputType: ").append(toIndentedString(outputType)).append("\n");
    sb.append("    outputURL: ").append(toIndentedString(outputURL)).append("\n");
    sb.append("    processedCount: ").append(toIndentedString(processedCount)).append("\n");
    sb.append("    startedOn: ").append(toIndentedString(startedOn)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    success: ").append(toIndentedString(success)).append("\n");
    sb.append("    successCount: ").append(toIndentedString(successCount)).append("\n");
    sb.append("    totalCount: ").append(toIndentedString(totalCount)).append("\n");
    sb.append("    uploadedBy: ").append(toIndentedString(uploadedBy)).append("\n");
    sb.append("    uploadedOn: ").append(toIndentedString(uploadedOn)).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("actionType");
    openapiFields.add("endedOn");
    openapiFields.add("errorCount");
    openapiFields.add("inputSize");
    openapiFields.add("outputSize");
    openapiFields.add("outputType");
    openapiFields.add("outputURL");
    openapiFields.add("processedCount");
    openapiFields.add("startedOn");
    openapiFields.add("status");
    openapiFields.add("success");
    openapiFields.add("successCount");
    openapiFields.add("totalCount");
    openapiFields.add("uploadedBy");
    openapiFields.add("uploadedOn");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

  /**
   * Validates the JSON Element and throws an exception if issues found
   *
   * @param jsonElement JSON Element
   * @throws IOException if the JSON Element is invalid with respect to GetMassUpdateResponse
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!GetMassUpdateResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in GetMassUpdateResponse is not found in the empty JSON string", GetMassUpdateResponse.openapiRequiredFields.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if ((jsonObj.get("actionType") != null && !jsonObj.get("actionType").isJsonNull()) && !jsonObj.get("actionType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `actionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionType").toString()));
      }
      if ((jsonObj.get("endedOn") != null && !jsonObj.get("endedOn").isJsonNull()) && !jsonObj.get("endedOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `endedOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endedOn").toString()));
      }
      if ((jsonObj.get("errorCount") != null && !jsonObj.get("errorCount").isJsonNull()) && !jsonObj.get("errorCount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `errorCount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorCount").toString()));
      }
      if ((jsonObj.get("outputType") != null && !jsonObj.get("outputType").isJsonNull()) && !jsonObj.get("outputType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `outputType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("outputType").toString()));
      }
      if ((jsonObj.get("outputURL") != null && !jsonObj.get("outputURL").isJsonNull()) && !jsonObj.get("outputURL").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `outputURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("outputURL").toString()));
      }
      if ((jsonObj.get("processedCount") != null && !jsonObj.get("processedCount").isJsonNull()) && !jsonObj.get("processedCount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `processedCount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("processedCount").toString()));
      }
      if ((jsonObj.get("startedOn") != null && !jsonObj.get("startedOn").isJsonNull()) && !jsonObj.get("startedOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `startedOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("startedOn").toString()));
      }
      if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
      }
      if ((jsonObj.get("successCount") != null && !jsonObj.get("successCount").isJsonNull()) && !jsonObj.get("successCount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `successCount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("successCount").toString()));
      }
      if ((jsonObj.get("totalCount") != null && !jsonObj.get("totalCount").isJsonNull()) && !jsonObj.get("totalCount").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `totalCount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("totalCount").toString()));
      }
      if ((jsonObj.get("uploadedBy") != null && !jsonObj.get("uploadedBy").isJsonNull()) && !jsonObj.get("uploadedBy").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `uploadedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploadedBy").toString()));
      }
      if ((jsonObj.get("uploadedOn") != null && !jsonObj.get("uploadedOn").isJsonNull()) && !jsonObj.get("uploadedOn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `uploadedOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploadedOn").toString()));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, GetMassUpdateResponse value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");

             // support null values
             out.beginObject();
             Iterator iterator = obj.entrySet().iterator();
             while(iterator.hasNext()) {
                 Map.Entry e = (Map.Entry) iterator.next();
                 out.name((String)e.getKey());
                 elementAdapter.write(out, e.getValue());
             }

             // end

             // serialize additional properties
             if (value.getAdditionalProperties() != null) {
               // support null values
               boolean oldSerializeNulls = out.getSerializeNulls();
               out.setSerializeNulls(true); //force serialize
               // end
               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 if (entry.getValue() == null)
                    obj.add(entry.getKey(), null);
                 else {
                   JsonElement jsonElement = gson.toJsonTree(entry.getValue());
                   if (jsonElement.isJsonArray()) {
                     obj.add(entry.getKey(), jsonElement.getAsJsonArray());
                   } else {
                     obj.add(entry.getKey(), jsonElement.getAsJsonObject());
                   }
                 }
                 out.name((String)entry.getKey());
                 elementAdapter.write(out, obj.get(entry.getKey()));
               }
               out.setSerializeNulls(oldSerializeNulls); //restore
             }
             out.endObject();

           }

           @Override
           public GetMassUpdateResponse read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             JsonObject jsonObj = jsonElement.getAsJsonObject();
             // store additional fields in the deserialized instance
             GetMassUpdateResponse 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 if (entry.getValue().isJsonArray()) {
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
                 } else { // JSON object
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2025 Weber Informatics LLC | Privacy Policy