com.zuora.model.BillRun 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.BillRunFilter;
import com.zuora.model.BillRunSchedule;
import com.zuora.model.BillRunStatus;
import com.zuora.model.ChargeType;
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;
/**
* BillRun
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class BillRun {
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_BILL_RUN_NUMBER = "billRunNumber";
@SerializedName(SERIALIZED_NAME_BILL_RUN_NUMBER)
private String billRunNumber;
public static final String SERIALIZED_NAME_BATCHES = "batches";
@SerializedName(SERIALIZED_NAME_BATCHES)
private List batches;
public static final String SERIALIZED_NAME_BILL_CYCLE_DAY = "billCycleDay";
@SerializedName(SERIALIZED_NAME_BILL_CYCLE_DAY)
private String billCycleDay;
public static final String SERIALIZED_NAME_BILL_RUN_FILTERS = "billRunFilters";
@SerializedName(SERIALIZED_NAME_BILL_RUN_FILTERS)
private List billRunFilters;
public static final String SERIALIZED_NAME_CHARGE_TYPE_TO_EXCLUDE = "chargeTypeToExclude";
@SerializedName(SERIALIZED_NAME_CHARGE_TYPE_TO_EXCLUDE)
private List chargeTypeToExclude;
public static final String SERIALIZED_NAME_AUTO_EMAIL = "autoEmail";
@SerializedName(SERIALIZED_NAME_AUTO_EMAIL)
private Boolean autoEmail;
public static final String SERIALIZED_NAME_AUTO_POST = "autoPost";
@SerializedName(SERIALIZED_NAME_AUTO_POST)
private Boolean autoPost;
public static final String SERIALIZED_NAME_AUTO_RENEWAL = "autoRenewal";
@SerializedName(SERIALIZED_NAME_AUTO_RENEWAL)
private Boolean autoRenewal;
public static final String SERIALIZED_NAME_NO_EMAIL_FOR_ZERO_AMOUNT_INVOICE = "noEmailForZeroAmountInvoice";
@SerializedName(SERIALIZED_NAME_NO_EMAIL_FOR_ZERO_AMOUNT_INVOICE)
private Boolean noEmailForZeroAmountInvoice;
public static final String SERIALIZED_NAME_SCHEDULE = "schedule";
@SerializedName(SERIALIZED_NAME_SCHEDULE)
private BillRunSchedule schedule;
public static final String SERIALIZED_NAME_SCHEDULED_EXECUTION_TIME = "scheduledExecutionTime";
@SerializedName(SERIALIZED_NAME_SCHEDULED_EXECUTION_TIME)
private String scheduledExecutionTime;
public static final String SERIALIZED_NAME_STATUS = "status";
@SerializedName(SERIALIZED_NAME_STATUS)
private BillRunStatus status;
public static final String SERIALIZED_NAME_INVOICE_DATE = "invoiceDate";
@SerializedName(SERIALIZED_NAME_INVOICE_DATE)
private LocalDate invoiceDate;
public static final String SERIALIZED_NAME_INVOICE_DATE_OFFSET = "invoiceDateOffset";
@SerializedName(SERIALIZED_NAME_INVOICE_DATE_OFFSET)
private Integer invoiceDateOffset;
public static final String SERIALIZED_NAME_INVOICE_DATE_MONTH_OFFSET = "invoiceDateMonthOffset";
@SerializedName(SERIALIZED_NAME_INVOICE_DATE_MONTH_OFFSET)
private Integer invoiceDateMonthOffset;
public static final String SERIALIZED_NAME_INVOICE_DATE_DAY_OF_MONTH = "invoiceDateDayOfMonth";
@SerializedName(SERIALIZED_NAME_INVOICE_DATE_DAY_OF_MONTH)
private Integer invoiceDateDayOfMonth;
public static final String SERIALIZED_NAME_TARGET_DATE = "targetDate";
@SerializedName(SERIALIZED_NAME_TARGET_DATE)
private LocalDate targetDate;
public static final String SERIALIZED_NAME_TARGET_DATE_OFFSET = "targetDateOffset";
@SerializedName(SERIALIZED_NAME_TARGET_DATE_OFFSET)
private Integer targetDateOffset;
public static final String SERIALIZED_NAME_TARGET_DATE_MONTH_OFFSET = "targetDateMonthOffset";
@SerializedName(SERIALIZED_NAME_TARGET_DATE_MONTH_OFFSET)
private Integer targetDateMonthOffset;
public static final String SERIALIZED_NAME_TARGET_DATE_DAY_OF_MONTH = "targetDateDayOfMonth";
@SerializedName(SERIALIZED_NAME_TARGET_DATE_DAY_OF_MONTH)
private Integer targetDateDayOfMonth;
public static final String SERIALIZED_NAME_CREATED_BY_ID = "createdById";
@SerializedName(SERIALIZED_NAME_CREATED_BY_ID)
private String createdById;
public static final String SERIALIZED_NAME_CREATED_DATE = "createdDate";
@SerializedName(SERIALIZED_NAME_CREATED_DATE)
private String createdDate;
public static final String SERIALIZED_NAME_UPDATED_BY_ID = "updatedById";
@SerializedName(SERIALIZED_NAME_UPDATED_BY_ID)
private String updatedById;
public static final String SERIALIZED_NAME_UPDATED_DATE = "updatedDate";
@SerializedName(SERIALIZED_NAME_UPDATED_DATE)
private String updatedDate;
public BillRun() {
}
public BillRun id(String id) {
this.id = id;
return this;
}
/**
* The unique ID of the bill run.
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public BillRun name(String name) {
this.name = name;
return this;
}
/**
* The name of the bill run.
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BillRun billRunNumber(String billRunNumber) {
this.billRunNumber = billRunNumber;
return this;
}
/**
* The number of the bill run.
* @return billRunNumber
*/
@javax.annotation.Nullable
public String getBillRunNumber() {
return billRunNumber;
}
public void setBillRunNumber(String billRunNumber) {
this.billRunNumber = billRunNumber;
}
public BillRun batches(List batches) {
this.batches = batches;
return this;
}
public BillRun addBatchesItem(String batchesItem) {
if (this.batches == null) {
this.batches = new ArrayList<>();
}
this.batches.add(batchesItem);
return this;
}
/**
* The batch of accounts for this bill run, this field can not exist with `billRunFilters` together. **Values:** `AllBatches` or an array of `Batch`*n* where *n* is a number between 1 and 50, for example, `Batch7`.
* @return batches
*/
@javax.annotation.Nullable
public List getBatches() {
return batches;
}
public void setBatches(List batches) {
this.batches = batches;
}
public BillRun billCycleDay(String billCycleDay) {
this.billCycleDay = billCycleDay;
return this;
}
/**
* The day of the bill cycle, this field is only valid when `batches` is specified. **Values:** - `AllBillCycleDays` or one of numbers 1 - 31 for an ad-hoc bill run - `AllBillCycleDays`, one of numbers 1 - 31, or `AsRunDay` for a scheduled bill run
* @return billCycleDay
*/
@javax.annotation.Nullable
public String getBillCycleDay() {
return billCycleDay;
}
public void setBillCycleDay(String billCycleDay) {
this.billCycleDay = billCycleDay;
}
public BillRun billRunFilters(List billRunFilters) {
this.billRunFilters = billRunFilters;
return this;
}
public BillRun addBillRunFiltersItem(BillRunFilter billRunFiltersItem) {
if (this.billRunFilters == null) {
this.billRunFilters = new ArrayList<>();
}
this.billRunFilters.add(billRunFiltersItem);
return this;
}
/**
* The target account or subscriptions for this bill run.
* @return billRunFilters
*/
@javax.annotation.Nullable
public List getBillRunFilters() {
return billRunFilters;
}
public void setBillRunFilters(List billRunFilters) {
this.billRunFilters = billRunFilters;
}
public BillRun chargeTypeToExclude(List chargeTypeToExclude) {
this.chargeTypeToExclude = chargeTypeToExclude;
return this;
}
public BillRun addChargeTypeToExcludeItem(ChargeType chargeTypeToExcludeItem) {
if (this.chargeTypeToExclude == null) {
this.chargeTypeToExclude = new ArrayList<>();
}
this.chargeTypeToExclude.add(chargeTypeToExcludeItem);
return this;
}
/**
* The types of the charges to be excluded from the generation of billing documents.
* @return chargeTypeToExclude
*/
@javax.annotation.Nullable
public List getChargeTypeToExclude() {
return chargeTypeToExclude;
}
public void setChargeTypeToExclude(List chargeTypeToExclude) {
this.chargeTypeToExclude = chargeTypeToExclude;
}
public BillRun autoEmail(Boolean autoEmail) {
this.autoEmail = autoEmail;
return this;
}
/**
* Whether to automatically send emails after Auto-Post is complete.
* @return autoEmail
*/
@javax.annotation.Nullable
public Boolean getAutoEmail() {
return autoEmail;
}
public void setAutoEmail(Boolean autoEmail) {
this.autoEmail = autoEmail;
}
public BillRun autoPost(Boolean autoPost) {
this.autoPost = autoPost;
return this;
}
/**
* Whether to automatically post the bill run after the bill run is created.
* @return autoPost
*/
@javax.annotation.Nullable
public Boolean getAutoPost() {
return autoPost;
}
public void setAutoPost(Boolean autoPost) {
this.autoPost = autoPost;
}
public BillRun autoRenewal(Boolean autoRenewal) {
this.autoRenewal = autoRenewal;
return this;
}
/**
* Whether to automatically renew auto-renew subscriptions that are up for renewal.
* @return autoRenewal
*/
@javax.annotation.Nullable
public Boolean getAutoRenewal() {
return autoRenewal;
}
public void setAutoRenewal(Boolean autoRenewal) {
this.autoRenewal = autoRenewal;
}
public BillRun noEmailForZeroAmountInvoice(Boolean noEmailForZeroAmountInvoice) {
this.noEmailForZeroAmountInvoice = noEmailForZeroAmountInvoice;
return this;
}
/**
* Whether to suppress emails for invoices with zero total amount generated in this bill run after the bill run is complete.
* @return noEmailForZeroAmountInvoice
*/
@javax.annotation.Nullable
public Boolean getNoEmailForZeroAmountInvoice() {
return noEmailForZeroAmountInvoice;
}
public void setNoEmailForZeroAmountInvoice(Boolean noEmailForZeroAmountInvoice) {
this.noEmailForZeroAmountInvoice = noEmailForZeroAmountInvoice;
}
public BillRun schedule(BillRunSchedule schedule) {
this.schedule = schedule;
return this;
}
/**
* Get schedule
* @return schedule
*/
@javax.annotation.Nullable
public BillRunSchedule getSchedule() {
return schedule;
}
public void setSchedule(BillRunSchedule schedule) {
this.schedule = schedule;
}
public BillRun scheduledExecutionTime(String scheduledExecutionTime) {
this.scheduledExecutionTime = scheduledExecutionTime;
return this;
}
/**
* The scheduled execution time for a bill run.
* @return scheduledExecutionTime
*/
@javax.annotation.Nullable
public String getScheduledExecutionTime() {
return scheduledExecutionTime;
}
public void setScheduledExecutionTime(String scheduledExecutionTime) {
this.scheduledExecutionTime = scheduledExecutionTime;
}
public BillRun status(BillRunStatus status) {
this.status = status;
return this;
}
/**
* Get status
* @return status
*/
@javax.annotation.Nullable
public BillRunStatus getStatus() {
return status;
}
public void setStatus(BillRunStatus status) {
this.status = status;
}
public BillRun invoiceDate(LocalDate invoiceDate) {
this.invoiceDate = invoiceDate;
return this;
}
/**
* The invoice date for this bill run, only valid for ad-hoc bill runs.
* @return invoiceDate
*/
@javax.annotation.Nullable
public LocalDate getInvoiceDate() {
return invoiceDate;
}
public void setInvoiceDate(LocalDate invoiceDate) {
this.invoiceDate = invoiceDate;
}
public BillRun invoiceDateOffset(Integer invoiceDateOffset) {
this.invoiceDateOffset = invoiceDateOffset;
return this;
}
/**
* The offset compared to bill run execution date, only valid for scheduled bill runs.
* @return invoiceDateOffset
*/
@javax.annotation.Nullable
public Integer getInvoiceDateOffset() {
return invoiceDateOffset;
}
public void setInvoiceDateOffset(Integer invoiceDateOffset) {
this.invoiceDateOffset = invoiceDateOffset;
}
public BillRun invoiceDateMonthOffset(Integer invoiceDateMonthOffset) {
this.invoiceDateMonthOffset = invoiceDateMonthOffset;
return this;
}
/**
* The month offset of invoice date for this bill run based on run date, only valid for monthly scheduled bill runs. invoiceDateOffset and invoiceDateMonthOffset/invoiceDateDayOfMonth are mutually exclusive. invoiceDateMonthOffset and invoiceDateDayOfMonth coexist.
* @return invoiceDateMonthOffset
*/
@javax.annotation.Nullable
public Integer getInvoiceDateMonthOffset() {
return invoiceDateMonthOffset;
}
public void setInvoiceDateMonthOffset(Integer invoiceDateMonthOffset) {
this.invoiceDateMonthOffset = invoiceDateMonthOffset;
}
public BillRun invoiceDateDayOfMonth(Integer invoiceDateDayOfMonth) {
this.invoiceDateDayOfMonth = invoiceDateDayOfMonth;
return this;
}
/**
* The day of month of invoice date for this bill run, only valid for monthly scheduled bill runs. The value is between 1 and 31, where 31 = end-of-month. invoiceDateOffset and invoiceDateMonthOffset/invoiceDateDayOfMonth are mutually exclusive. invoiceDateMonthOffset and invoiceDateDayOfMonth coexist.
* minimum: 1
* maximum: 31
* @return invoiceDateDayOfMonth
*/
@javax.annotation.Nullable
public Integer getInvoiceDateDayOfMonth() {
return invoiceDateDayOfMonth;
}
public void setInvoiceDateDayOfMonth(Integer invoiceDateDayOfMonth) {
this.invoiceDateDayOfMonth = invoiceDateDayOfMonth;
}
public BillRun targetDate(LocalDate targetDate) {
this.targetDate = targetDate;
return this;
}
/**
* The target date for this bill run, only valid for ad-hoc bill runs.
* @return targetDate
*/
@javax.annotation.Nullable
public LocalDate getTargetDate() {
return targetDate;
}
public void setTargetDate(LocalDate targetDate) {
this.targetDate = targetDate;
}
public BillRun targetDateOffset(Integer targetDateOffset) {
this.targetDateOffset = targetDateOffset;
return this;
}
/**
* The offset compared to bill run execution date, only valid for scheduled bill runs.
* @return targetDateOffset
*/
@javax.annotation.Nullable
public Integer getTargetDateOffset() {
return targetDateOffset;
}
public void setTargetDateOffset(Integer targetDateOffset) {
this.targetDateOffset = targetDateOffset;
}
public BillRun targetDateMonthOffset(Integer targetDateMonthOffset) {
this.targetDateMonthOffset = targetDateMonthOffset;
return this;
}
/**
* The month offset of target date for this bill run based on run date, only valid for monthly scheduled bill runs. targetDateOffset and targetDateMonthOffset/targetDateDayOfMonth are mutually exclusive. targetDateMonthOffset and targetDateDayOfMonth coexist.
* @return targetDateMonthOffset
*/
@javax.annotation.Nullable
public Integer getTargetDateMonthOffset() {
return targetDateMonthOffset;
}
public void setTargetDateMonthOffset(Integer targetDateMonthOffset) {
this.targetDateMonthOffset = targetDateMonthOffset;
}
public BillRun targetDateDayOfMonth(Integer targetDateDayOfMonth) {
this.targetDateDayOfMonth = targetDateDayOfMonth;
return this;
}
/**
* The day of month of target date for this bill run, only valid for monthly scheduled bill runs. The value is between 1 and 31, where 31 = end-of-month. targetDateOffset and targetDateMonthOffset/targetDateDayOfMonth are mutually exclusive. targetDateMonthOffset and targetDateDayOfMonth coexist.
* minimum: 1
* maximum: 31
* @return targetDateDayOfMonth
*/
@javax.annotation.Nullable
public Integer getTargetDateDayOfMonth() {
return targetDateDayOfMonth;
}
public void setTargetDateDayOfMonth(Integer targetDateDayOfMonth) {
this.targetDateDayOfMonth = targetDateDayOfMonth;
}
public BillRun createdById(String createdById) {
this.createdById = createdById;
return this;
}
/**
* The ID of the user who created the bill run.
* @return createdById
*/
@javax.annotation.Nullable
public String getCreatedById() {
return createdById;
}
public void setCreatedById(String createdById) {
this.createdById = createdById;
}
public BillRun createdDate(String createdDate) {
this.createdDate = createdDate;
return this;
}
/**
* The date and time when the bill run was created.
* @return createdDate
*/
@javax.annotation.Nullable
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
public BillRun updatedById(String updatedById) {
this.updatedById = updatedById;
return this;
}
/**
* The ID of the user who last updated the bill run.
* @return updatedById
*/
@javax.annotation.Nullable
public String getUpdatedById() {
return updatedById;
}
public void setUpdatedById(String updatedById) {
this.updatedById = updatedById;
}
public BillRun updatedDate(String updatedDate) {
this.updatedDate = updatedDate;
return this;
}
/**
* The date and time when the bill run was last updated.
* @return updatedDate
*/
@javax.annotation.Nullable
public String getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(String updatedDate) {
this.updatedDate = updatedDate;
}
/**
* 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 BillRun instance itself
*/
public BillRun 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;
}
BillRun billRun = (BillRun) o;
return Objects.equals(this.id, billRun.id) &&
Objects.equals(this.name, billRun.name) &&
Objects.equals(this.billRunNumber, billRun.billRunNumber) &&
Objects.equals(this.batches, billRun.batches) &&
Objects.equals(this.billCycleDay, billRun.billCycleDay) &&
Objects.equals(this.billRunFilters, billRun.billRunFilters) &&
Objects.equals(this.chargeTypeToExclude, billRun.chargeTypeToExclude) &&
Objects.equals(this.autoEmail, billRun.autoEmail) &&
Objects.equals(this.autoPost, billRun.autoPost) &&
Objects.equals(this.autoRenewal, billRun.autoRenewal) &&
Objects.equals(this.noEmailForZeroAmountInvoice, billRun.noEmailForZeroAmountInvoice) &&
Objects.equals(this.schedule, billRun.schedule) &&
Objects.equals(this.scheduledExecutionTime, billRun.scheduledExecutionTime) &&
Objects.equals(this.status, billRun.status) &&
Objects.equals(this.invoiceDate, billRun.invoiceDate) &&
Objects.equals(this.invoiceDateOffset, billRun.invoiceDateOffset) &&
Objects.equals(this.invoiceDateMonthOffset, billRun.invoiceDateMonthOffset) &&
Objects.equals(this.invoiceDateDayOfMonth, billRun.invoiceDateDayOfMonth) &&
Objects.equals(this.targetDate, billRun.targetDate) &&
Objects.equals(this.targetDateOffset, billRun.targetDateOffset) &&
Objects.equals(this.targetDateMonthOffset, billRun.targetDateMonthOffset) &&
Objects.equals(this.targetDateDayOfMonth, billRun.targetDateDayOfMonth) &&
Objects.equals(this.createdById, billRun.createdById) &&
Objects.equals(this.createdDate, billRun.createdDate) &&
Objects.equals(this.updatedById, billRun.updatedById) &&
Objects.equals(this.updatedDate, billRun.updatedDate)&&
Objects.equals(this.additionalProperties, billRun.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(id, name, billRunNumber, batches, billCycleDay, billRunFilters, chargeTypeToExclude, autoEmail, autoPost, autoRenewal, noEmailForZeroAmountInvoice, schedule, scheduledExecutionTime, status, invoiceDate, invoiceDateOffset, invoiceDateMonthOffset, invoiceDateDayOfMonth, targetDate, targetDateOffset, targetDateMonthOffset, targetDateDayOfMonth, createdById, createdDate, updatedById, updatedDate, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BillRun {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" billRunNumber: ").append(toIndentedString(billRunNumber)).append("\n");
sb.append(" batches: ").append(toIndentedString(batches)).append("\n");
sb.append(" billCycleDay: ").append(toIndentedString(billCycleDay)).append("\n");
sb.append(" billRunFilters: ").append(toIndentedString(billRunFilters)).append("\n");
sb.append(" chargeTypeToExclude: ").append(toIndentedString(chargeTypeToExclude)).append("\n");
sb.append(" autoEmail: ").append(toIndentedString(autoEmail)).append("\n");
sb.append(" autoPost: ").append(toIndentedString(autoPost)).append("\n");
sb.append(" autoRenewal: ").append(toIndentedString(autoRenewal)).append("\n");
sb.append(" noEmailForZeroAmountInvoice: ").append(toIndentedString(noEmailForZeroAmountInvoice)).append("\n");
sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n");
sb.append(" scheduledExecutionTime: ").append(toIndentedString(scheduledExecutionTime)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" invoiceDate: ").append(toIndentedString(invoiceDate)).append("\n");
sb.append(" invoiceDateOffset: ").append(toIndentedString(invoiceDateOffset)).append("\n");
sb.append(" invoiceDateMonthOffset: ").append(toIndentedString(invoiceDateMonthOffset)).append("\n");
sb.append(" invoiceDateDayOfMonth: ").append(toIndentedString(invoiceDateDayOfMonth)).append("\n");
sb.append(" targetDate: ").append(toIndentedString(targetDate)).append("\n");
sb.append(" targetDateOffset: ").append(toIndentedString(targetDateOffset)).append("\n");
sb.append(" targetDateMonthOffset: ").append(toIndentedString(targetDateMonthOffset)).append("\n");
sb.append(" targetDateDayOfMonth: ").append(toIndentedString(targetDateDayOfMonth)).append("\n");
sb.append(" createdById: ").append(toIndentedString(createdById)).append("\n");
sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n");
sb.append(" updatedById: ").append(toIndentedString(updatedById)).append("\n");
sb.append(" updatedDate: ").append(toIndentedString(updatedDate)).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("id");
openapiFields.add("name");
openapiFields.add("billRunNumber");
openapiFields.add("batches");
openapiFields.add("billCycleDay");
openapiFields.add("billRunFilters");
openapiFields.add("chargeTypeToExclude");
openapiFields.add("autoEmail");
openapiFields.add("autoPost");
openapiFields.add("autoRenewal");
openapiFields.add("noEmailForZeroAmountInvoice");
openapiFields.add("schedule");
openapiFields.add("scheduledExecutionTime");
openapiFields.add("status");
openapiFields.add("invoiceDate");
openapiFields.add("invoiceDateOffset");
openapiFields.add("invoiceDateMonthOffset");
openapiFields.add("invoiceDateDayOfMonth");
openapiFields.add("targetDate");
openapiFields.add("targetDateOffset");
openapiFields.add("targetDateMonthOffset");
openapiFields.add("targetDateDayOfMonth");
openapiFields.add("createdById");
openapiFields.add("createdDate");
openapiFields.add("updatedById");
openapiFields.add("updatedDate");
// 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 BillRun
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!BillRun.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in BillRun is not found in the empty JSON string", BillRun.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
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("billRunNumber") != null && !jsonObj.get("billRunNumber").isJsonNull()) && !jsonObj.get("billRunNumber").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `billRunNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("billRunNumber").toString()));
}
// ensure the optional json data is an array if present
if (jsonObj.get("batches") != null && !jsonObj.get("batches").isJsonNull() && !jsonObj.get("batches").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `batches` to be an array in the JSON string but got `%s`", jsonObj.get("batches").toString()));
}
if ((jsonObj.get("billCycleDay") != null && !jsonObj.get("billCycleDay").isJsonNull()) && !jsonObj.get("billCycleDay").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `billCycleDay` to be a primitive type in the JSON string but got `%s`", jsonObj.get("billCycleDay").toString()));
}
if (jsonObj.get("billRunFilters") != null && !jsonObj.get("billRunFilters").isJsonNull()) {
JsonArray jsonArraybillRunFilters = jsonObj.getAsJsonArray("billRunFilters");
if (jsonArraybillRunFilters != null) {
// ensure the json data is an array
if (!jsonObj.get("billRunFilters").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `billRunFilters` to be an array in the JSON string but got `%s`", jsonObj.get("billRunFilters").toString()));
}
// validate the optional field `billRunFilters` (array)
for (int i = 0; i < jsonArraybillRunFilters.size(); i++) {
BillRunFilter.validateJsonElement(jsonArraybillRunFilters.get(i));
};
}
}
// ensure the optional json data is an array if present
if (jsonObj.get("chargeTypeToExclude") != null && !jsonObj.get("chargeTypeToExclude").isJsonNull() && !jsonObj.get("chargeTypeToExclude").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `chargeTypeToExclude` to be an array in the JSON string but got `%s`", jsonObj.get("chargeTypeToExclude").toString()));
}
// validate the optional field `schedule`
if (jsonObj.get("schedule") != null && !jsonObj.get("schedule").isJsonNull()) {
BillRunSchedule.validateJsonElement(jsonObj.get("schedule"));
}
if ((jsonObj.get("scheduledExecutionTime") != null && !jsonObj.get("scheduledExecutionTime").isJsonNull()) && !jsonObj.get("scheduledExecutionTime").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `scheduledExecutionTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scheduledExecutionTime").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()));
}
// validate the optional field `status`
if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) {
BillRunStatus.validateJsonElement(jsonObj.get("status"));
}
if ((jsonObj.get("createdById") != null && !jsonObj.get("createdById").isJsonNull()) && !jsonObj.get("createdById").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `createdById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdById").toString()));
}
if ((jsonObj.get("createdDate") != null && !jsonObj.get("createdDate").isJsonNull()) && !jsonObj.get("createdDate").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `createdDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdDate").toString()));
}
if ((jsonObj.get("updatedById") != null && !jsonObj.get("updatedById").isJsonNull()) && !jsonObj.get("updatedById").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `updatedById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedById").toString()));
}
if ((jsonObj.get("updatedDate") != null && !jsonObj.get("updatedDate").isJsonNull()) && !jsonObj.get("updatedDate").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `updatedDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedDate").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!BillRun.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'BillRun' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(BillRun.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, BillRun 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 BillRun read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
BillRun 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 BillRun given an JSON string
*
* @param jsonString JSON string
* @return An instance of BillRun
* @throws IOException if the JSON string is invalid with respect to BillRun
*/
public static BillRun fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, BillRun.class);
}
/**
* Convert an instance of BillRun to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy