com.zuora.model.GetAccountingPeriodResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zuora-sdk-java Show documentation
Show all versions of zuora-sdk-java Show documentation
The SDK of JAVA language for Zuora pricing system
/*
* 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 com.zuora.model.GetAccountingPeriodAllOfFieIdsResponse;
import com.zuora.model.OrganizationLabel;
import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
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 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;
/**
* GetAccountingPeriodResponse
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class GetAccountingPeriodResponse {
public static final String SERIALIZED_NAME_CREATED_BY = "createdBy";
@SerializedName(SERIALIZED_NAME_CREATED_BY)
private String createdBy;
public static final String SERIALIZED_NAME_CREATED_ON = "createdOn";
@SerializedName(SERIALIZED_NAME_CREATED_ON)
private String createdOn;
public static final String SERIALIZED_NAME_END_DATE = "endDate";
@SerializedName(SERIALIZED_NAME_END_DATE)
private LocalDate endDate;
public static final String SERIALIZED_NAME_FILE_IDS = "fileIds";
@SerializedName(SERIALIZED_NAME_FILE_IDS)
private GetAccountingPeriodAllOfFieIdsResponse fileIds;
public static final String SERIALIZED_NAME_FISCAL_YEAR = "fiscalYear";
@SerializedName(SERIALIZED_NAME_FISCAL_YEAR)
private String fiscalYear;
public static final String SERIALIZED_NAME_FISCAL_QUARTER = "fiscal_quarter";
@SerializedName(SERIALIZED_NAME_FISCAL_QUARTER)
private Long fiscalQuarter;
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_NOTES = "notes";
@SerializedName(SERIALIZED_NAME_NOTES)
private String notes;
public static final String SERIALIZED_NAME_RUN_TRIAL_BALANCE_END = "runTrialBalanceEnd";
@SerializedName(SERIALIZED_NAME_RUN_TRIAL_BALANCE_END)
private String runTrialBalanceEnd;
public static final String SERIALIZED_NAME_RUN_TRIAL_BALANCE_ERROR_MESSAGE = "runTrialBalanceErrorMessage";
@SerializedName(SERIALIZED_NAME_RUN_TRIAL_BALANCE_ERROR_MESSAGE)
private String runTrialBalanceErrorMessage;
public static final String SERIALIZED_NAME_RUN_TRIAL_BALANCE_START = "runTrialBalanceStart";
@SerializedName(SERIALIZED_NAME_RUN_TRIAL_BALANCE_START)
private String runTrialBalanceStart;
public static final String SERIALIZED_NAME_RUN_TRIAL_BALANCE_STATUS = "runTrialBalanceStatus";
@SerializedName(SERIALIZED_NAME_RUN_TRIAL_BALANCE_STATUS)
private String runTrialBalanceStatus;
public static final String SERIALIZED_NAME_START_DATE = "startDate";
@SerializedName(SERIALIZED_NAME_START_DATE)
private LocalDate startDate;
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_UPDATED_BY = "updatedBy";
@SerializedName(SERIALIZED_NAME_UPDATED_BY)
private String updatedBy;
public static final String SERIALIZED_NAME_UPDATED_ON = "updatedOn";
@SerializedName(SERIALIZED_NAME_UPDATED_ON)
private String updatedOn;
public static final String SERIALIZED_NAME_ORGANIZATION_LABELS = "organizationLabels";
@SerializedName(SERIALIZED_NAME_ORGANIZATION_LABELS)
private List organizationLabels;
public GetAccountingPeriodResponse() {
}
public GetAccountingPeriodResponse createdBy(String createdBy) {
this.createdBy = createdBy;
return this;
}
/**
* ID of the user who created the accounting period.
* @return createdBy
*/
@javax.annotation.Nullable
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public GetAccountingPeriodResponse createdOn(String createdOn) {
this.createdOn = createdOn;
return this;
}
/**
* Date and time when the accounting period was created.
* @return createdOn
*/
@javax.annotation.Nullable
public String getCreatedOn() {
return createdOn;
}
public void setCreatedOn(String createdOn) {
this.createdOn = createdOn;
}
public GetAccountingPeriodResponse endDate(LocalDate endDate) {
this.endDate = endDate;
return this;
}
/**
* The end date of the accounting period.
* @return endDate
*/
@javax.annotation.Nullable
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public GetAccountingPeriodResponse fileIds(GetAccountingPeriodAllOfFieIdsResponse fileIds) {
this.fileIds = fileIds;
return this;
}
/**
* Get fileIds
* @return fileIds
*/
@javax.annotation.Nullable
public GetAccountingPeriodAllOfFieIdsResponse getFileIds() {
return fileIds;
}
public void setFileIds(GetAccountingPeriodAllOfFieIdsResponse fileIds) {
this.fileIds = fileIds;
}
public GetAccountingPeriodResponse fiscalYear(String fiscalYear) {
this.fiscalYear = fiscalYear;
return this;
}
/**
* Fiscal year of the accounting period.
* @return fiscalYear
*/
@javax.annotation.Nullable
public String getFiscalYear() {
return fiscalYear;
}
public void setFiscalYear(String fiscalYear) {
this.fiscalYear = fiscalYear;
}
public GetAccountingPeriodResponse fiscalQuarter(Long fiscalQuarter) {
this.fiscalQuarter = fiscalQuarter;
return this;
}
/**
*
* @return fiscalQuarter
*/
@javax.annotation.Nullable
public Long getFiscalQuarter() {
return fiscalQuarter;
}
public void setFiscalQuarter(Long fiscalQuarter) {
this.fiscalQuarter = fiscalQuarter;
}
public GetAccountingPeriodResponse id(String id) {
this.id = id;
return this;
}
/**
* ID of the accounting period.
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public GetAccountingPeriodResponse name(String name) {
this.name = name;
return this;
}
/**
* Name of the accounting period.
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public GetAccountingPeriodResponse notes(String notes) {
this.notes = notes;
return this;
}
/**
* Any optional notes about the accounting period.
* @return notes
*/
@javax.annotation.Nullable
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public GetAccountingPeriodResponse runTrialBalanceEnd(String runTrialBalanceEnd) {
this.runTrialBalanceEnd = runTrialBalanceEnd;
return this;
}
/**
* Date and time that the trial balance was completed. If the trial balance status is `Pending`, `Processing`, or `Error`, this field is `null`.
* @return runTrialBalanceEnd
*/
@javax.annotation.Nullable
public String getRunTrialBalanceEnd() {
return runTrialBalanceEnd;
}
public void setRunTrialBalanceEnd(String runTrialBalanceEnd) {
this.runTrialBalanceEnd = runTrialBalanceEnd;
}
public GetAccountingPeriodResponse runTrialBalanceErrorMessage(String runTrialBalanceErrorMessage) {
this.runTrialBalanceErrorMessage = runTrialBalanceErrorMessage;
return this;
}
/**
* If trial balance status is Error, an error message is returned in this field.
* @return runTrialBalanceErrorMessage
*/
@javax.annotation.Nullable
public String getRunTrialBalanceErrorMessage() {
return runTrialBalanceErrorMessage;
}
public void setRunTrialBalanceErrorMessage(String runTrialBalanceErrorMessage) {
this.runTrialBalanceErrorMessage = runTrialBalanceErrorMessage;
}
public GetAccountingPeriodResponse runTrialBalanceStart(String runTrialBalanceStart) {
this.runTrialBalanceStart = runTrialBalanceStart;
return this;
}
/**
* Date and time that the trial balance was run. If the trial balance status is Pending, this field is null.
* @return runTrialBalanceStart
*/
@javax.annotation.Nullable
public String getRunTrialBalanceStart() {
return runTrialBalanceStart;
}
public void setRunTrialBalanceStart(String runTrialBalanceStart) {
this.runTrialBalanceStart = runTrialBalanceStart;
}
public GetAccountingPeriodResponse runTrialBalanceStatus(String runTrialBalanceStatus) {
this.runTrialBalanceStatus = runTrialBalanceStatus;
return this;
}
/**
* Status of the trial balance for the accounting period. Possible values: * `Pending` * `Processing` * `Completed` * `Error`
* @return runTrialBalanceStatus
*/
@javax.annotation.Nullable
public String getRunTrialBalanceStatus() {
return runTrialBalanceStatus;
}
public void setRunTrialBalanceStatus(String runTrialBalanceStatus) {
this.runTrialBalanceStatus = runTrialBalanceStatus;
}
public GetAccountingPeriodResponse startDate(LocalDate startDate) {
this.startDate = startDate;
return this;
}
/**
* The start date of the accounting period.
* @return startDate
*/
@javax.annotation.Nullable
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public GetAccountingPeriodResponse status(String status) {
this.status = status;
return this;
}
/**
* Status of the accounting period. Possible values: * `Open` * `PendingClose` * `Closed`
* @return status
*/
@javax.annotation.Nullable
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public GetAccountingPeriodResponse 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 GetAccountingPeriodResponse updatedBy(String updatedBy) {
this.updatedBy = updatedBy;
return this;
}
/**
* ID of the user who last updated the accounting period.
* @return updatedBy
*/
@javax.annotation.Nullable
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public GetAccountingPeriodResponse updatedOn(String updatedOn) {
this.updatedOn = updatedOn;
return this;
}
/**
* Date and time when the accounting period was last updated.
* @return updatedOn
*/
@javax.annotation.Nullable
public String getUpdatedOn() {
return updatedOn;
}
public void setUpdatedOn(String updatedOn) {
this.updatedOn = updatedOn;
}
public GetAccountingPeriodResponse organizationLabels(List organizationLabels) {
this.organizationLabels = organizationLabels;
return this;
}
public GetAccountingPeriodResponse addOrganizationLabelsItem(OrganizationLabel organizationLabelsItem) {
if (this.organizationLabels == null) {
this.organizationLabels = new ArrayList<>();
}
this.organizationLabels.add(organizationLabelsItem);
return this;
}
/**
* Organization labels.
* @return organizationLabels
*/
@javax.annotation.Nullable
public List getOrganizationLabels() {
return organizationLabels;
}
public void setOrganizationLabels(List organizationLabels) {
this.organizationLabels = organizationLabels;
}
/**
* 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 GetAccountingPeriodResponse instance itself
*/
public GetAccountingPeriodResponse 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;
}
GetAccountingPeriodResponse getAccountingPeriodResponse = (GetAccountingPeriodResponse) o;
return Objects.equals(this.createdBy, getAccountingPeriodResponse.createdBy) &&
Objects.equals(this.createdOn, getAccountingPeriodResponse.createdOn) &&
Objects.equals(this.endDate, getAccountingPeriodResponse.endDate) &&
Objects.equals(this.fileIds, getAccountingPeriodResponse.fileIds) &&
Objects.equals(this.fiscalYear, getAccountingPeriodResponse.fiscalYear) &&
Objects.equals(this.fiscalQuarter, getAccountingPeriodResponse.fiscalQuarter) &&
Objects.equals(this.id, getAccountingPeriodResponse.id) &&
Objects.equals(this.name, getAccountingPeriodResponse.name) &&
Objects.equals(this.notes, getAccountingPeriodResponse.notes) &&
Objects.equals(this.runTrialBalanceEnd, getAccountingPeriodResponse.runTrialBalanceEnd) &&
Objects.equals(this.runTrialBalanceErrorMessage, getAccountingPeriodResponse.runTrialBalanceErrorMessage) &&
Objects.equals(this.runTrialBalanceStart, getAccountingPeriodResponse.runTrialBalanceStart) &&
Objects.equals(this.runTrialBalanceStatus, getAccountingPeriodResponse.runTrialBalanceStatus) &&
Objects.equals(this.startDate, getAccountingPeriodResponse.startDate) &&
Objects.equals(this.status, getAccountingPeriodResponse.status) &&
Objects.equals(this.success, getAccountingPeriodResponse.success) &&
Objects.equals(this.updatedBy, getAccountingPeriodResponse.updatedBy) &&
Objects.equals(this.updatedOn, getAccountingPeriodResponse.updatedOn) &&
Objects.equals(this.organizationLabels, getAccountingPeriodResponse.organizationLabels)&&
Objects.equals(this.additionalProperties, getAccountingPeriodResponse.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(createdBy, createdOn, endDate, fileIds, fiscalYear, fiscalQuarter, id, name, notes, runTrialBalanceEnd, runTrialBalanceErrorMessage, runTrialBalanceStart, runTrialBalanceStatus, startDate, status, success, updatedBy, updatedOn, organizationLabels, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GetAccountingPeriodResponse {\n");
sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n");
sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n");
sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n");
sb.append(" fileIds: ").append(toIndentedString(fileIds)).append("\n");
sb.append(" fiscalYear: ").append(toIndentedString(fiscalYear)).append("\n");
sb.append(" fiscalQuarter: ").append(toIndentedString(fiscalQuarter)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" notes: ").append(toIndentedString(notes)).append("\n");
sb.append(" runTrialBalanceEnd: ").append(toIndentedString(runTrialBalanceEnd)).append("\n");
sb.append(" runTrialBalanceErrorMessage: ").append(toIndentedString(runTrialBalanceErrorMessage)).append("\n");
sb.append(" runTrialBalanceStart: ").append(toIndentedString(runTrialBalanceStart)).append("\n");
sb.append(" runTrialBalanceStatus: ").append(toIndentedString(runTrialBalanceStatus)).append("\n");
sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" success: ").append(toIndentedString(success)).append("\n");
sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n");
sb.append(" updatedOn: ").append(toIndentedString(updatedOn)).append("\n");
sb.append(" organizationLabels: ").append(toIndentedString(organizationLabels)).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("createdBy");
openapiFields.add("createdOn");
openapiFields.add("endDate");
openapiFields.add("fileIds");
openapiFields.add("fiscalYear");
openapiFields.add("fiscal_quarter");
openapiFields.add("id");
openapiFields.add("name");
openapiFields.add("notes");
openapiFields.add("runTrialBalanceEnd");
openapiFields.add("runTrialBalanceErrorMessage");
openapiFields.add("runTrialBalanceStart");
openapiFields.add("runTrialBalanceStatus");
openapiFields.add("startDate");
openapiFields.add("status");
openapiFields.add("success");
openapiFields.add("updatedBy");
openapiFields.add("updatedOn");
openapiFields.add("organizationLabels");
// 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 GetAccountingPeriodResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!GetAccountingPeriodResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in GetAccountingPeriodResponse is not found in the empty JSON string", GetAccountingPeriodResponse.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) && !jsonObj.get("createdBy").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString()));
}
if ((jsonObj.get("createdOn") != null && !jsonObj.get("createdOn").isJsonNull()) && !jsonObj.get("createdOn").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `createdOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdOn").toString()));
}
// validate the optional field `fileIds`
if (jsonObj.get("fileIds") != null && !jsonObj.get("fileIds").isJsonNull()) {
GetAccountingPeriodAllOfFieIdsResponse.validateJsonElement(jsonObj.get("fileIds"));
}
if ((jsonObj.get("fiscalYear") != null && !jsonObj.get("fiscalYear").isJsonNull()) && !jsonObj.get("fiscalYear").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `fiscalYear` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fiscalYear").toString()));
}
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("notes") != null && !jsonObj.get("notes").isJsonNull()) && !jsonObj.get("notes").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `notes` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notes").toString()));
}
if ((jsonObj.get("runTrialBalanceEnd") != null && !jsonObj.get("runTrialBalanceEnd").isJsonNull()) && !jsonObj.get("runTrialBalanceEnd").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `runTrialBalanceEnd` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runTrialBalanceEnd").toString()));
}
if ((jsonObj.get("runTrialBalanceErrorMessage") != null && !jsonObj.get("runTrialBalanceErrorMessage").isJsonNull()) && !jsonObj.get("runTrialBalanceErrorMessage").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `runTrialBalanceErrorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runTrialBalanceErrorMessage").toString()));
}
if ((jsonObj.get("runTrialBalanceStart") != null && !jsonObj.get("runTrialBalanceStart").isJsonNull()) && !jsonObj.get("runTrialBalanceStart").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `runTrialBalanceStart` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runTrialBalanceStart").toString()));
}
if ((jsonObj.get("runTrialBalanceStatus") != null && !jsonObj.get("runTrialBalanceStatus").isJsonNull()) && !jsonObj.get("runTrialBalanceStatus").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `runTrialBalanceStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runTrialBalanceStatus").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("updatedBy") != null && !jsonObj.get("updatedBy").isJsonNull()) && !jsonObj.get("updatedBy").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `updatedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedBy").toString()));
}
if ((jsonObj.get("updatedOn") != null && !jsonObj.get("updatedOn").isJsonNull()) && !jsonObj.get("updatedOn").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `updatedOn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedOn").toString()));
}
if (jsonObj.get("organizationLabels") != null && !jsonObj.get("organizationLabels").isJsonNull()) {
JsonArray jsonArrayorganizationLabels = jsonObj.getAsJsonArray("organizationLabels");
if (jsonArrayorganizationLabels != null) {
// ensure the json data is an array
if (!jsonObj.get("organizationLabels").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `organizationLabels` to be an array in the JSON string but got `%s`", jsonObj.get("organizationLabels").toString()));
}
// validate the optional field `organizationLabels` (array)
for (int i = 0; i < jsonArrayorganizationLabels.size(); i++) {
OrganizationLabel.validateJsonElement(jsonArrayorganizationLabels.get(i));
};
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!GetAccountingPeriodResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'GetAccountingPeriodResponse' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(GetAccountingPeriodResponse.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, GetAccountingPeriodResponse 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 GetAccountingPeriodResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
GetAccountingPeriodResponse 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 GetAccountingPeriodResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of GetAccountingPeriodResponse
* @throws IOException if the JSON string is invalid with respect to GetAccountingPeriodResponse
*/
public static GetAccountingPeriodResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, GetAccountingPeriodResponse.class);
}
/**
* Convert an instance of GetAccountingPeriodResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy