com.zuora.model.RatePlanChargeOverridePricing 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.DiscountPricingOverride;
import com.zuora.model.OneTimeFlatFeePricingOverride;
import com.zuora.model.OneTimePerUnitPricingOverride;
import com.zuora.model.OneTimeTieredPricingOverride;
import com.zuora.model.OneTimeVolumePricingOverride;
import com.zuora.model.OrderActionRatePlanChargeModelDataOverride;
import com.zuora.model.OrderActionRatePlanRecurringDeliveryPricingOverride;
import com.zuora.model.OrderActionRatePlanRecurringFlatFeePricingOverride;
import com.zuora.model.OrderActionRatePlanRecurringPerUnitPricingOverride;
import com.zuora.model.OrderActionRatePlanRecurringTieredPricingOverride;
import com.zuora.model.OrderActionRatePlanRecurringVolumePricingOverride;
import com.zuora.model.UsageFlatFeePricingOverride;
import com.zuora.model.UsageOveragePricingOverride;
import com.zuora.model.UsagePerUnitPricingOverride;
import com.zuora.model.UsageTieredPricingOverride;
import com.zuora.model.UsageTieredWithOveragePricingOverride;
import com.zuora.model.UsageVolumePricingOverride;
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;
/**
* Pricing information about the charge.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class RatePlanChargeOverridePricing {
public static final String SERIALIZED_NAME_CHARGE_MODEL_DATA = "chargeModelData";
@SerializedName(SERIALIZED_NAME_CHARGE_MODEL_DATA)
private OrderActionRatePlanChargeModelDataOverride chargeModelData;
public static final String SERIALIZED_NAME_DISCOUNT = "discount";
@SerializedName(SERIALIZED_NAME_DISCOUNT)
private DiscountPricingOverride discount;
public static final String SERIALIZED_NAME_ONE_TIME_FLAT_FEE = "oneTimeFlatFee";
@SerializedName(SERIALIZED_NAME_ONE_TIME_FLAT_FEE)
private OneTimeFlatFeePricingOverride oneTimeFlatFee;
public static final String SERIALIZED_NAME_ONE_TIME_PER_UNIT = "oneTimePerUnit";
@SerializedName(SERIALIZED_NAME_ONE_TIME_PER_UNIT)
private OneTimePerUnitPricingOverride oneTimePerUnit;
public static final String SERIALIZED_NAME_ONE_TIME_TIERED = "oneTimeTiered";
@SerializedName(SERIALIZED_NAME_ONE_TIME_TIERED)
private OneTimeTieredPricingOverride oneTimeTiered;
public static final String SERIALIZED_NAME_ONE_TIME_VOLUME = "oneTimeVolume";
@SerializedName(SERIALIZED_NAME_ONE_TIME_VOLUME)
private OneTimeVolumePricingOverride oneTimeVolume;
public static final String SERIALIZED_NAME_RECURRING_DELIVERY = "recurringDelivery";
@SerializedName(SERIALIZED_NAME_RECURRING_DELIVERY)
private OrderActionRatePlanRecurringDeliveryPricingOverride recurringDelivery;
public static final String SERIALIZED_NAME_RECURRING_FLAT_FEE = "recurringFlatFee";
@SerializedName(SERIALIZED_NAME_RECURRING_FLAT_FEE)
private OrderActionRatePlanRecurringFlatFeePricingOverride recurringFlatFee;
public static final String SERIALIZED_NAME_RECURRING_PER_UNIT = "recurringPerUnit";
@SerializedName(SERIALIZED_NAME_RECURRING_PER_UNIT)
private OrderActionRatePlanRecurringPerUnitPricingOverride recurringPerUnit;
public static final String SERIALIZED_NAME_RECURRING_TIERED = "recurringTiered";
@SerializedName(SERIALIZED_NAME_RECURRING_TIERED)
private OrderActionRatePlanRecurringTieredPricingOverride recurringTiered;
public static final String SERIALIZED_NAME_RECURRING_VOLUME = "recurringVolume";
@SerializedName(SERIALIZED_NAME_RECURRING_VOLUME)
private OrderActionRatePlanRecurringVolumePricingOverride recurringVolume;
public static final String SERIALIZED_NAME_USAGE_FLAT_FEE = "usageFlatFee";
@SerializedName(SERIALIZED_NAME_USAGE_FLAT_FEE)
private UsageFlatFeePricingOverride usageFlatFee;
public static final String SERIALIZED_NAME_USAGE_OVERAGE = "usageOverage";
@SerializedName(SERIALIZED_NAME_USAGE_OVERAGE)
private UsageOveragePricingOverride usageOverage;
public static final String SERIALIZED_NAME_USAGE_PER_UNIT = "usagePerUnit";
@SerializedName(SERIALIZED_NAME_USAGE_PER_UNIT)
private UsagePerUnitPricingOverride usagePerUnit;
public static final String SERIALIZED_NAME_USAGE_TIERED = "usageTiered";
@SerializedName(SERIALIZED_NAME_USAGE_TIERED)
private UsageTieredPricingOverride usageTiered;
public static final String SERIALIZED_NAME_USAGE_TIERED_WITH_OVERAGE = "usageTieredWithOverage";
@SerializedName(SERIALIZED_NAME_USAGE_TIERED_WITH_OVERAGE)
private UsageTieredWithOveragePricingOverride usageTieredWithOverage;
public static final String SERIALIZED_NAME_USAGE_VOLUME = "usageVolume";
@SerializedName(SERIALIZED_NAME_USAGE_VOLUME)
private UsageVolumePricingOverride usageVolume;
public RatePlanChargeOverridePricing() {
}
public RatePlanChargeOverridePricing chargeModelData(OrderActionRatePlanChargeModelDataOverride chargeModelData) {
this.chargeModelData = chargeModelData;
return this;
}
/**
* Get chargeModelData
* @return chargeModelData
*/
@javax.annotation.Nullable
public OrderActionRatePlanChargeModelDataOverride getChargeModelData() {
return chargeModelData;
}
public void setChargeModelData(OrderActionRatePlanChargeModelDataOverride chargeModelData) {
this.chargeModelData = chargeModelData;
}
public RatePlanChargeOverridePricing discount(DiscountPricingOverride discount) {
this.discount = discount;
return this;
}
/**
* Get discount
* @return discount
*/
@javax.annotation.Nullable
public DiscountPricingOverride getDiscount() {
return discount;
}
public void setDiscount(DiscountPricingOverride discount) {
this.discount = discount;
}
public RatePlanChargeOverridePricing oneTimeFlatFee(OneTimeFlatFeePricingOverride oneTimeFlatFee) {
this.oneTimeFlatFee = oneTimeFlatFee;
return this;
}
/**
* Get oneTimeFlatFee
* @return oneTimeFlatFee
*/
@javax.annotation.Nullable
public OneTimeFlatFeePricingOverride getOneTimeFlatFee() {
return oneTimeFlatFee;
}
public void setOneTimeFlatFee(OneTimeFlatFeePricingOverride oneTimeFlatFee) {
this.oneTimeFlatFee = oneTimeFlatFee;
}
public RatePlanChargeOverridePricing oneTimePerUnit(OneTimePerUnitPricingOverride oneTimePerUnit) {
this.oneTimePerUnit = oneTimePerUnit;
return this;
}
/**
* Get oneTimePerUnit
* @return oneTimePerUnit
*/
@javax.annotation.Nullable
public OneTimePerUnitPricingOverride getOneTimePerUnit() {
return oneTimePerUnit;
}
public void setOneTimePerUnit(OneTimePerUnitPricingOverride oneTimePerUnit) {
this.oneTimePerUnit = oneTimePerUnit;
}
public RatePlanChargeOverridePricing oneTimeTiered(OneTimeTieredPricingOverride oneTimeTiered) {
this.oneTimeTiered = oneTimeTiered;
return this;
}
/**
* Get oneTimeTiered
* @return oneTimeTiered
*/
@javax.annotation.Nullable
public OneTimeTieredPricingOverride getOneTimeTiered() {
return oneTimeTiered;
}
public void setOneTimeTiered(OneTimeTieredPricingOverride oneTimeTiered) {
this.oneTimeTiered = oneTimeTiered;
}
public RatePlanChargeOverridePricing oneTimeVolume(OneTimeVolumePricingOverride oneTimeVolume) {
this.oneTimeVolume = oneTimeVolume;
return this;
}
/**
* Get oneTimeVolume
* @return oneTimeVolume
*/
@javax.annotation.Nullable
public OneTimeVolumePricingOverride getOneTimeVolume() {
return oneTimeVolume;
}
public void setOneTimeVolume(OneTimeVolumePricingOverride oneTimeVolume) {
this.oneTimeVolume = oneTimeVolume;
}
public RatePlanChargeOverridePricing recurringDelivery(OrderActionRatePlanRecurringDeliveryPricingOverride recurringDelivery) {
this.recurringDelivery = recurringDelivery;
return this;
}
/**
* Get recurringDelivery
* @return recurringDelivery
*/
@javax.annotation.Nullable
public OrderActionRatePlanRecurringDeliveryPricingOverride getRecurringDelivery() {
return recurringDelivery;
}
public void setRecurringDelivery(OrderActionRatePlanRecurringDeliveryPricingOverride recurringDelivery) {
this.recurringDelivery = recurringDelivery;
}
public RatePlanChargeOverridePricing recurringFlatFee(OrderActionRatePlanRecurringFlatFeePricingOverride recurringFlatFee) {
this.recurringFlatFee = recurringFlatFee;
return this;
}
/**
* Get recurringFlatFee
* @return recurringFlatFee
*/
@javax.annotation.Nullable
public OrderActionRatePlanRecurringFlatFeePricingOverride getRecurringFlatFee() {
return recurringFlatFee;
}
public void setRecurringFlatFee(OrderActionRatePlanRecurringFlatFeePricingOverride recurringFlatFee) {
this.recurringFlatFee = recurringFlatFee;
}
public RatePlanChargeOverridePricing recurringPerUnit(OrderActionRatePlanRecurringPerUnitPricingOverride recurringPerUnit) {
this.recurringPerUnit = recurringPerUnit;
return this;
}
/**
* Get recurringPerUnit
* @return recurringPerUnit
*/
@javax.annotation.Nullable
public OrderActionRatePlanRecurringPerUnitPricingOverride getRecurringPerUnit() {
return recurringPerUnit;
}
public void setRecurringPerUnit(OrderActionRatePlanRecurringPerUnitPricingOverride recurringPerUnit) {
this.recurringPerUnit = recurringPerUnit;
}
public RatePlanChargeOverridePricing recurringTiered(OrderActionRatePlanRecurringTieredPricingOverride recurringTiered) {
this.recurringTiered = recurringTiered;
return this;
}
/**
* Get recurringTiered
* @return recurringTiered
*/
@javax.annotation.Nullable
public OrderActionRatePlanRecurringTieredPricingOverride getRecurringTiered() {
return recurringTiered;
}
public void setRecurringTiered(OrderActionRatePlanRecurringTieredPricingOverride recurringTiered) {
this.recurringTiered = recurringTiered;
}
public RatePlanChargeOverridePricing recurringVolume(OrderActionRatePlanRecurringVolumePricingOverride recurringVolume) {
this.recurringVolume = recurringVolume;
return this;
}
/**
* Get recurringVolume
* @return recurringVolume
*/
@javax.annotation.Nullable
public OrderActionRatePlanRecurringVolumePricingOverride getRecurringVolume() {
return recurringVolume;
}
public void setRecurringVolume(OrderActionRatePlanRecurringVolumePricingOverride recurringVolume) {
this.recurringVolume = recurringVolume;
}
public RatePlanChargeOverridePricing usageFlatFee(UsageFlatFeePricingOverride usageFlatFee) {
this.usageFlatFee = usageFlatFee;
return this;
}
/**
* Get usageFlatFee
* @return usageFlatFee
*/
@javax.annotation.Nullable
public UsageFlatFeePricingOverride getUsageFlatFee() {
return usageFlatFee;
}
public void setUsageFlatFee(UsageFlatFeePricingOverride usageFlatFee) {
this.usageFlatFee = usageFlatFee;
}
public RatePlanChargeOverridePricing usageOverage(UsageOveragePricingOverride usageOverage) {
this.usageOverage = usageOverage;
return this;
}
/**
* Get usageOverage
* @return usageOverage
*/
@javax.annotation.Nullable
public UsageOveragePricingOverride getUsageOverage() {
return usageOverage;
}
public void setUsageOverage(UsageOveragePricingOverride usageOverage) {
this.usageOverage = usageOverage;
}
public RatePlanChargeOverridePricing usagePerUnit(UsagePerUnitPricingOverride usagePerUnit) {
this.usagePerUnit = usagePerUnit;
return this;
}
/**
* Get usagePerUnit
* @return usagePerUnit
*/
@javax.annotation.Nullable
public UsagePerUnitPricingOverride getUsagePerUnit() {
return usagePerUnit;
}
public void setUsagePerUnit(UsagePerUnitPricingOverride usagePerUnit) {
this.usagePerUnit = usagePerUnit;
}
public RatePlanChargeOverridePricing usageTiered(UsageTieredPricingOverride usageTiered) {
this.usageTiered = usageTiered;
return this;
}
/**
* Get usageTiered
* @return usageTiered
*/
@javax.annotation.Nullable
public UsageTieredPricingOverride getUsageTiered() {
return usageTiered;
}
public void setUsageTiered(UsageTieredPricingOverride usageTiered) {
this.usageTiered = usageTiered;
}
public RatePlanChargeOverridePricing usageTieredWithOverage(UsageTieredWithOveragePricingOverride usageTieredWithOverage) {
this.usageTieredWithOverage = usageTieredWithOverage;
return this;
}
/**
* Get usageTieredWithOverage
* @return usageTieredWithOverage
*/
@javax.annotation.Nullable
public UsageTieredWithOveragePricingOverride getUsageTieredWithOverage() {
return usageTieredWithOverage;
}
public void setUsageTieredWithOverage(UsageTieredWithOveragePricingOverride usageTieredWithOverage) {
this.usageTieredWithOverage = usageTieredWithOverage;
}
public RatePlanChargeOverridePricing usageVolume(UsageVolumePricingOverride usageVolume) {
this.usageVolume = usageVolume;
return this;
}
/**
* Get usageVolume
* @return usageVolume
*/
@javax.annotation.Nullable
public UsageVolumePricingOverride getUsageVolume() {
return usageVolume;
}
public void setUsageVolume(UsageVolumePricingOverride usageVolume) {
this.usageVolume = usageVolume;
}
/**
* 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 RatePlanChargeOverridePricing instance itself
*/
public RatePlanChargeOverridePricing 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;
}
RatePlanChargeOverridePricing ratePlanChargeOverridePricing = (RatePlanChargeOverridePricing) o;
return Objects.equals(this.chargeModelData, ratePlanChargeOverridePricing.chargeModelData) &&
Objects.equals(this.discount, ratePlanChargeOverridePricing.discount) &&
Objects.equals(this.oneTimeFlatFee, ratePlanChargeOverridePricing.oneTimeFlatFee) &&
Objects.equals(this.oneTimePerUnit, ratePlanChargeOverridePricing.oneTimePerUnit) &&
Objects.equals(this.oneTimeTiered, ratePlanChargeOverridePricing.oneTimeTiered) &&
Objects.equals(this.oneTimeVolume, ratePlanChargeOverridePricing.oneTimeVolume) &&
Objects.equals(this.recurringDelivery, ratePlanChargeOverridePricing.recurringDelivery) &&
Objects.equals(this.recurringFlatFee, ratePlanChargeOverridePricing.recurringFlatFee) &&
Objects.equals(this.recurringPerUnit, ratePlanChargeOverridePricing.recurringPerUnit) &&
Objects.equals(this.recurringTiered, ratePlanChargeOverridePricing.recurringTiered) &&
Objects.equals(this.recurringVolume, ratePlanChargeOverridePricing.recurringVolume) &&
Objects.equals(this.usageFlatFee, ratePlanChargeOverridePricing.usageFlatFee) &&
Objects.equals(this.usageOverage, ratePlanChargeOverridePricing.usageOverage) &&
Objects.equals(this.usagePerUnit, ratePlanChargeOverridePricing.usagePerUnit) &&
Objects.equals(this.usageTiered, ratePlanChargeOverridePricing.usageTiered) &&
Objects.equals(this.usageTieredWithOverage, ratePlanChargeOverridePricing.usageTieredWithOverage) &&
Objects.equals(this.usageVolume, ratePlanChargeOverridePricing.usageVolume)&&
Objects.equals(this.additionalProperties, ratePlanChargeOverridePricing.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(chargeModelData, discount, oneTimeFlatFee, oneTimePerUnit, oneTimeTiered, oneTimeVolume, recurringDelivery, recurringFlatFee, recurringPerUnit, recurringTiered, recurringVolume, usageFlatFee, usageOverage, usagePerUnit, usageTiered, usageTieredWithOverage, usageVolume, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RatePlanChargeOverridePricing {\n");
sb.append(" chargeModelData: ").append(toIndentedString(chargeModelData)).append("\n");
sb.append(" discount: ").append(toIndentedString(discount)).append("\n");
sb.append(" oneTimeFlatFee: ").append(toIndentedString(oneTimeFlatFee)).append("\n");
sb.append(" oneTimePerUnit: ").append(toIndentedString(oneTimePerUnit)).append("\n");
sb.append(" oneTimeTiered: ").append(toIndentedString(oneTimeTiered)).append("\n");
sb.append(" oneTimeVolume: ").append(toIndentedString(oneTimeVolume)).append("\n");
sb.append(" recurringDelivery: ").append(toIndentedString(recurringDelivery)).append("\n");
sb.append(" recurringFlatFee: ").append(toIndentedString(recurringFlatFee)).append("\n");
sb.append(" recurringPerUnit: ").append(toIndentedString(recurringPerUnit)).append("\n");
sb.append(" recurringTiered: ").append(toIndentedString(recurringTiered)).append("\n");
sb.append(" recurringVolume: ").append(toIndentedString(recurringVolume)).append("\n");
sb.append(" usageFlatFee: ").append(toIndentedString(usageFlatFee)).append("\n");
sb.append(" usageOverage: ").append(toIndentedString(usageOverage)).append("\n");
sb.append(" usagePerUnit: ").append(toIndentedString(usagePerUnit)).append("\n");
sb.append(" usageTiered: ").append(toIndentedString(usageTiered)).append("\n");
sb.append(" usageTieredWithOverage: ").append(toIndentedString(usageTieredWithOverage)).append("\n");
sb.append(" usageVolume: ").append(toIndentedString(usageVolume)).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("chargeModelData");
openapiFields.add("discount");
openapiFields.add("oneTimeFlatFee");
openapiFields.add("oneTimePerUnit");
openapiFields.add("oneTimeTiered");
openapiFields.add("oneTimeVolume");
openapiFields.add("recurringDelivery");
openapiFields.add("recurringFlatFee");
openapiFields.add("recurringPerUnit");
openapiFields.add("recurringTiered");
openapiFields.add("recurringVolume");
openapiFields.add("usageFlatFee");
openapiFields.add("usageOverage");
openapiFields.add("usagePerUnit");
openapiFields.add("usageTiered");
openapiFields.add("usageTieredWithOverage");
openapiFields.add("usageVolume");
// 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 RatePlanChargeOverridePricing
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RatePlanChargeOverridePricing.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RatePlanChargeOverridePricing is not found in the empty JSON string", RatePlanChargeOverridePricing.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `chargeModelData`
if (jsonObj.get("chargeModelData") != null && !jsonObj.get("chargeModelData").isJsonNull()) {
OrderActionRatePlanChargeModelDataOverride.validateJsonElement(jsonObj.get("chargeModelData"));
}
// validate the optional field `discount`
if (jsonObj.get("discount") != null && !jsonObj.get("discount").isJsonNull()) {
DiscountPricingOverride.validateJsonElement(jsonObj.get("discount"));
}
// validate the optional field `oneTimeFlatFee`
if (jsonObj.get("oneTimeFlatFee") != null && !jsonObj.get("oneTimeFlatFee").isJsonNull()) {
OneTimeFlatFeePricingOverride.validateJsonElement(jsonObj.get("oneTimeFlatFee"));
}
// validate the optional field `oneTimePerUnit`
if (jsonObj.get("oneTimePerUnit") != null && !jsonObj.get("oneTimePerUnit").isJsonNull()) {
OneTimePerUnitPricingOverride.validateJsonElement(jsonObj.get("oneTimePerUnit"));
}
// validate the optional field `oneTimeTiered`
if (jsonObj.get("oneTimeTiered") != null && !jsonObj.get("oneTimeTiered").isJsonNull()) {
OneTimeTieredPricingOverride.validateJsonElement(jsonObj.get("oneTimeTiered"));
}
// validate the optional field `oneTimeVolume`
if (jsonObj.get("oneTimeVolume") != null && !jsonObj.get("oneTimeVolume").isJsonNull()) {
OneTimeVolumePricingOverride.validateJsonElement(jsonObj.get("oneTimeVolume"));
}
// validate the optional field `recurringDelivery`
if (jsonObj.get("recurringDelivery") != null && !jsonObj.get("recurringDelivery").isJsonNull()) {
OrderActionRatePlanRecurringDeliveryPricingOverride.validateJsonElement(jsonObj.get("recurringDelivery"));
}
// validate the optional field `recurringFlatFee`
if (jsonObj.get("recurringFlatFee") != null && !jsonObj.get("recurringFlatFee").isJsonNull()) {
OrderActionRatePlanRecurringFlatFeePricingOverride.validateJsonElement(jsonObj.get("recurringFlatFee"));
}
// validate the optional field `recurringPerUnit`
if (jsonObj.get("recurringPerUnit") != null && !jsonObj.get("recurringPerUnit").isJsonNull()) {
OrderActionRatePlanRecurringPerUnitPricingOverride.validateJsonElement(jsonObj.get("recurringPerUnit"));
}
// validate the optional field `recurringTiered`
if (jsonObj.get("recurringTiered") != null && !jsonObj.get("recurringTiered").isJsonNull()) {
OrderActionRatePlanRecurringTieredPricingOverride.validateJsonElement(jsonObj.get("recurringTiered"));
}
// validate the optional field `recurringVolume`
if (jsonObj.get("recurringVolume") != null && !jsonObj.get("recurringVolume").isJsonNull()) {
OrderActionRatePlanRecurringVolumePricingOverride.validateJsonElement(jsonObj.get("recurringVolume"));
}
// validate the optional field `usageFlatFee`
if (jsonObj.get("usageFlatFee") != null && !jsonObj.get("usageFlatFee").isJsonNull()) {
UsageFlatFeePricingOverride.validateJsonElement(jsonObj.get("usageFlatFee"));
}
// validate the optional field `usageOverage`
if (jsonObj.get("usageOverage") != null && !jsonObj.get("usageOverage").isJsonNull()) {
UsageOveragePricingOverride.validateJsonElement(jsonObj.get("usageOverage"));
}
// validate the optional field `usagePerUnit`
if (jsonObj.get("usagePerUnit") != null && !jsonObj.get("usagePerUnit").isJsonNull()) {
UsagePerUnitPricingOverride.validateJsonElement(jsonObj.get("usagePerUnit"));
}
// validate the optional field `usageTiered`
if (jsonObj.get("usageTiered") != null && !jsonObj.get("usageTiered").isJsonNull()) {
UsageTieredPricingOverride.validateJsonElement(jsonObj.get("usageTiered"));
}
// validate the optional field `usageTieredWithOverage`
if (jsonObj.get("usageTieredWithOverage") != null && !jsonObj.get("usageTieredWithOverage").isJsonNull()) {
UsageTieredWithOveragePricingOverride.validateJsonElement(jsonObj.get("usageTieredWithOverage"));
}
// validate the optional field `usageVolume`
if (jsonObj.get("usageVolume") != null && !jsonObj.get("usageVolume").isJsonNull()) {
UsageVolumePricingOverride.validateJsonElement(jsonObj.get("usageVolume"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!RatePlanChargeOverridePricing.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RatePlanChargeOverridePricing' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RatePlanChargeOverridePricing.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, RatePlanChargeOverridePricing 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 RatePlanChargeOverridePricing read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
RatePlanChargeOverridePricing 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 RatePlanChargeOverridePricing given an JSON string
*
* @param jsonString JSON string
* @return An instance of RatePlanChargeOverridePricing
* @throws IOException if the JSON string is invalid with respect to RatePlanChargeOverridePricing
*/
public static RatePlanChargeOverridePricing fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RatePlanChargeOverridePricing.class);
}
/**
* Convert an instance of RatePlanChargeOverridePricing to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy