com.zuora.model.UpdateFulfillmentRequest 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.FulfillmentState;
import com.zuora.model.FulfillmentType;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
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;
/**
* UpdateFulfillmentRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class UpdateFulfillmentRequest {
public static final String SERIALIZED_NAME_BILL_TARGET_DATE = "billTargetDate";
@SerializedName(SERIALIZED_NAME_BILL_TARGET_DATE)
private LocalDate billTargetDate;
public static final String SERIALIZED_NAME_CARRIER = "carrier";
@SerializedName(SERIALIZED_NAME_CARRIER)
private String carrier;
public static final String SERIALIZED_NAME_CUSTOM_FIELDS = "customFields";
@SerializedName(SERIALIZED_NAME_CUSTOM_FIELDS)
private Map customFields;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
private String description;
public static final String SERIALIZED_NAME_EXCLUDE_ITEM_BILLING_FROM_REVENUE_ACCOUNTING = "excludeItemBillingFromRevenueAccounting";
@SerializedName(SERIALIZED_NAME_EXCLUDE_ITEM_BILLING_FROM_REVENUE_ACCOUNTING)
private Boolean excludeItemBillingFromRevenueAccounting;
public static final String SERIALIZED_NAME_EXCLUDE_ITEM_BOOKING_FROM_REVENUE_ACCOUNTING = "excludeItemBookingFromRevenueAccounting";
@SerializedName(SERIALIZED_NAME_EXCLUDE_ITEM_BOOKING_FROM_REVENUE_ACCOUNTING)
private Boolean excludeItemBookingFromRevenueAccounting;
public static final String SERIALIZED_NAME_EXTERNAL_ID = "externalId";
@SerializedName(SERIALIZED_NAME_EXTERNAL_ID)
private String externalId;
public static final String SERIALIZED_NAME_FULFILLMENT_DATE = "fulfillmentDate";
@SerializedName(SERIALIZED_NAME_FULFILLMENT_DATE)
private LocalDate fulfillmentDate;
public static final String SERIALIZED_NAME_FULFILLMENT_LOCATION = "fulfillmentLocation";
@SerializedName(SERIALIZED_NAME_FULFILLMENT_LOCATION)
private String fulfillmentLocation;
public static final String SERIALIZED_NAME_FULFILLMENT_SYSTEM = "fulfillmentSystem";
@SerializedName(SERIALIZED_NAME_FULFILLMENT_SYSTEM)
private String fulfillmentSystem;
public static final String SERIALIZED_NAME_FULFILLMENT_TYPE = "fulfillmentType";
@SerializedName(SERIALIZED_NAME_FULFILLMENT_TYPE)
private FulfillmentType fulfillmentType;
public static final String SERIALIZED_NAME_ORDER_LINE_ITEM_ID = "orderLineItemId";
@SerializedName(SERIALIZED_NAME_ORDER_LINE_ITEM_ID)
private String orderLineItemId;
public static final String SERIALIZED_NAME_QUANTITY = "quantity";
@SerializedName(SERIALIZED_NAME_QUANTITY)
private BigDecimal quantity;
public static final String SERIALIZED_NAME_STATE = "state";
@SerializedName(SERIALIZED_NAME_STATE)
private FulfillmentState state;
public static final String SERIALIZED_NAME_TRACKING_NUMBER = "trackingNumber";
@SerializedName(SERIALIZED_NAME_TRACKING_NUMBER)
private String trackingNumber;
public UpdateFulfillmentRequest() {
}
public UpdateFulfillmentRequest billTargetDate(LocalDate billTargetDate) {
this.billTargetDate = billTargetDate;
return this;
}
/**
* The target date for the Fulfillment to be picked up by bill run for billing.
* @return billTargetDate
*/
@javax.annotation.Nullable
public LocalDate getBillTargetDate() {
return billTargetDate;
}
public void setBillTargetDate(LocalDate billTargetDate) {
this.billTargetDate = billTargetDate;
}
public UpdateFulfillmentRequest carrier(String carrier) {
this.carrier = carrier;
return this;
}
/**
* The carrier of the Fulfillment. The available values can be managed in the Fulfillment Settings page under Billing Settings.
* @return carrier
*/
@javax.annotation.Nullable
public String getCarrier() {
return carrier;
}
public void setCarrier(String carrier) {
this.carrier = carrier;
}
public UpdateFulfillmentRequest customFields(Map customFields) {
this.customFields = customFields;
return this;
}
public UpdateFulfillmentRequest putCustomFieldsItem(String key, Object customFieldsItem) {
if (this.customFields == null) {
this.customFields = new HashMap<>();
}
this.customFields.put(key, customFieldsItem);
return this;
}
/**
* Container for custom fields of a Fulfillment object.
* @return customFields
*/
@javax.annotation.Nullable
public Map getCustomFields() {
return customFields;
}
public void setCustomFields(Map customFields) {
this.customFields = customFields;
}
public UpdateFulfillmentRequest description(String description) {
this.description = description;
return this;
}
/**
* The description of the Fulfillment.
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public UpdateFulfillmentRequest excludeItemBillingFromRevenueAccounting(Boolean excludeItemBillingFromRevenueAccounting) {
this.excludeItemBillingFromRevenueAccounting = excludeItemBillingFromRevenueAccounting;
return this;
}
/**
* The flag to exclude Fulfillment related invoice items, invoice item adjustments, credit memo items, and debit memo items from revenue accounting. **Note**: This field is only available if you have the Billing - Revenue Integration feature enabled.
* @return excludeItemBillingFromRevenueAccounting
*/
@javax.annotation.Nullable
public Boolean getExcludeItemBillingFromRevenueAccounting() {
return excludeItemBillingFromRevenueAccounting;
}
public void setExcludeItemBillingFromRevenueAccounting(Boolean excludeItemBillingFromRevenueAccounting) {
this.excludeItemBillingFromRevenueAccounting = excludeItemBillingFromRevenueAccounting;
}
public UpdateFulfillmentRequest excludeItemBookingFromRevenueAccounting(Boolean excludeItemBookingFromRevenueAccounting) {
this.excludeItemBookingFromRevenueAccounting = excludeItemBookingFromRevenueAccounting;
return this;
}
/**
* The flag to exclude Fulfillment from revenue accounting. **Note**: This field is only available if you have the Billing - Revenue Integration feature enabled.
* @return excludeItemBookingFromRevenueAccounting
*/
@javax.annotation.Nullable
public Boolean getExcludeItemBookingFromRevenueAccounting() {
return excludeItemBookingFromRevenueAccounting;
}
public void setExcludeItemBookingFromRevenueAccounting(Boolean excludeItemBookingFromRevenueAccounting) {
this.excludeItemBookingFromRevenueAccounting = excludeItemBookingFromRevenueAccounting;
}
public UpdateFulfillmentRequest externalId(String externalId) {
this.externalId = externalId;
return this;
}
/**
* The external id of the Fulfillment.
* @return externalId
*/
@javax.annotation.Nullable
public String getExternalId() {
return externalId;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
public UpdateFulfillmentRequest fulfillmentDate(LocalDate fulfillmentDate) {
this.fulfillmentDate = fulfillmentDate;
return this;
}
/**
* The date of the Fulfillment.
* @return fulfillmentDate
*/
@javax.annotation.Nullable
public LocalDate getFulfillmentDate() {
return fulfillmentDate;
}
public void setFulfillmentDate(LocalDate fulfillmentDate) {
this.fulfillmentDate = fulfillmentDate;
}
public UpdateFulfillmentRequest fulfillmentLocation(String fulfillmentLocation) {
this.fulfillmentLocation = fulfillmentLocation;
return this;
}
/**
* The fulfillment location of the Fulfillment. The available values can be managed in the Fulfillment Settings page under Billing Settings.
* @return fulfillmentLocation
*/
@javax.annotation.Nullable
public String getFulfillmentLocation() {
return fulfillmentLocation;
}
public void setFulfillmentLocation(String fulfillmentLocation) {
this.fulfillmentLocation = fulfillmentLocation;
}
public UpdateFulfillmentRequest fulfillmentSystem(String fulfillmentSystem) {
this.fulfillmentSystem = fulfillmentSystem;
return this;
}
/**
* The fulfillment system of the Fulfillment. The available values can be managed in the Fulfillment Settings page under Billing Settings.
* @return fulfillmentSystem
*/
@javax.annotation.Nullable
public String getFulfillmentSystem() {
return fulfillmentSystem;
}
public void setFulfillmentSystem(String fulfillmentSystem) {
this.fulfillmentSystem = fulfillmentSystem;
}
public UpdateFulfillmentRequest fulfillmentType(FulfillmentType fulfillmentType) {
this.fulfillmentType = fulfillmentType;
return this;
}
/**
* Get fulfillmentType
* @return fulfillmentType
*/
@javax.annotation.Nullable
public FulfillmentType getFulfillmentType() {
return fulfillmentType;
}
public void setFulfillmentType(FulfillmentType fulfillmentType) {
this.fulfillmentType = fulfillmentType;
}
public UpdateFulfillmentRequest orderLineItemId(String orderLineItemId) {
this.orderLineItemId = orderLineItemId;
return this;
}
/**
* The reference id of the related Order Line Ite
* @return orderLineItemId
*/
@javax.annotation.Nullable
public String getOrderLineItemId() {
return orderLineItemId;
}
public void setOrderLineItemId(String orderLineItemId) {
this.orderLineItemId = orderLineItemId;
}
public UpdateFulfillmentRequest quantity(BigDecimal quantity) {
this.quantity = quantity;
return this;
}
/**
* The quantity of the Fulfillment.
* @return quantity
*/
@javax.annotation.Nullable
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
public UpdateFulfillmentRequest state(FulfillmentState state) {
this.state = state;
return this;
}
/**
* Get state
* @return state
*/
@javax.annotation.Nullable
public FulfillmentState getState() {
return state;
}
public void setState(FulfillmentState state) {
this.state = state;
}
public UpdateFulfillmentRequest trackingNumber(String trackingNumber) {
this.trackingNumber = trackingNumber;
return this;
}
/**
* The tracking number of the Fulfillment.
* @return trackingNumber
*/
@javax.annotation.Nullable
public String getTrackingNumber() {
return trackingNumber;
}
public void setTrackingNumber(String trackingNumber) {
this.trackingNumber = trackingNumber;
}
/**
* 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 UpdateFulfillmentRequest instance itself
*/
public UpdateFulfillmentRequest 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;
}
UpdateFulfillmentRequest updateFulfillmentRequest = (UpdateFulfillmentRequest) o;
return Objects.equals(this.billTargetDate, updateFulfillmentRequest.billTargetDate) &&
Objects.equals(this.carrier, updateFulfillmentRequest.carrier) &&
Objects.equals(this.customFields, updateFulfillmentRequest.customFields) &&
Objects.equals(this.description, updateFulfillmentRequest.description) &&
Objects.equals(this.excludeItemBillingFromRevenueAccounting, updateFulfillmentRequest.excludeItemBillingFromRevenueAccounting) &&
Objects.equals(this.excludeItemBookingFromRevenueAccounting, updateFulfillmentRequest.excludeItemBookingFromRevenueAccounting) &&
Objects.equals(this.externalId, updateFulfillmentRequest.externalId) &&
Objects.equals(this.fulfillmentDate, updateFulfillmentRequest.fulfillmentDate) &&
Objects.equals(this.fulfillmentLocation, updateFulfillmentRequest.fulfillmentLocation) &&
Objects.equals(this.fulfillmentSystem, updateFulfillmentRequest.fulfillmentSystem) &&
Objects.equals(this.fulfillmentType, updateFulfillmentRequest.fulfillmentType) &&
Objects.equals(this.orderLineItemId, updateFulfillmentRequest.orderLineItemId) &&
Objects.equals(this.quantity, updateFulfillmentRequest.quantity) &&
Objects.equals(this.state, updateFulfillmentRequest.state) &&
Objects.equals(this.trackingNumber, updateFulfillmentRequest.trackingNumber)&&
Objects.equals(this.additionalProperties, updateFulfillmentRequest.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(billTargetDate, carrier, customFields, description, excludeItemBillingFromRevenueAccounting, excludeItemBookingFromRevenueAccounting, externalId, fulfillmentDate, fulfillmentLocation, fulfillmentSystem, fulfillmentType, orderLineItemId, quantity, state, trackingNumber, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdateFulfillmentRequest {\n");
sb.append(" billTargetDate: ").append(toIndentedString(billTargetDate)).append("\n");
sb.append(" carrier: ").append(toIndentedString(carrier)).append("\n");
sb.append(" customFields: ").append(toIndentedString(customFields)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" excludeItemBillingFromRevenueAccounting: ").append(toIndentedString(excludeItemBillingFromRevenueAccounting)).append("\n");
sb.append(" excludeItemBookingFromRevenueAccounting: ").append(toIndentedString(excludeItemBookingFromRevenueAccounting)).append("\n");
sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n");
sb.append(" fulfillmentDate: ").append(toIndentedString(fulfillmentDate)).append("\n");
sb.append(" fulfillmentLocation: ").append(toIndentedString(fulfillmentLocation)).append("\n");
sb.append(" fulfillmentSystem: ").append(toIndentedString(fulfillmentSystem)).append("\n");
sb.append(" fulfillmentType: ").append(toIndentedString(fulfillmentType)).append("\n");
sb.append(" orderLineItemId: ").append(toIndentedString(orderLineItemId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" trackingNumber: ").append(toIndentedString(trackingNumber)).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("billTargetDate");
openapiFields.add("carrier");
openapiFields.add("customFields");
openapiFields.add("description");
openapiFields.add("excludeItemBillingFromRevenueAccounting");
openapiFields.add("excludeItemBookingFromRevenueAccounting");
openapiFields.add("externalId");
openapiFields.add("fulfillmentDate");
openapiFields.add("fulfillmentLocation");
openapiFields.add("fulfillmentSystem");
openapiFields.add("fulfillmentType");
openapiFields.add("orderLineItemId");
openapiFields.add("quantity");
openapiFields.add("state");
openapiFields.add("trackingNumber");
// 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 UpdateFulfillmentRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UpdateFulfillmentRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFulfillmentRequest is not found in the empty JSON string", UpdateFulfillmentRequest.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("carrier") != null && !jsonObj.get("carrier").isJsonNull()) && !jsonObj.get("carrier").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `carrier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrier").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("externalId") != null && !jsonObj.get("externalId").isJsonNull()) && !jsonObj.get("externalId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `externalId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("externalId").toString()));
}
if ((jsonObj.get("fulfillmentLocation") != null && !jsonObj.get("fulfillmentLocation").isJsonNull()) && !jsonObj.get("fulfillmentLocation").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `fulfillmentLocation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fulfillmentLocation").toString()));
}
if ((jsonObj.get("fulfillmentSystem") != null && !jsonObj.get("fulfillmentSystem").isJsonNull()) && !jsonObj.get("fulfillmentSystem").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `fulfillmentSystem` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fulfillmentSystem").toString()));
}
if ((jsonObj.get("fulfillmentType") != null && !jsonObj.get("fulfillmentType").isJsonNull()) && !jsonObj.get("fulfillmentType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `fulfillmentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fulfillmentType").toString()));
}
// validate the optional field `fulfillmentType`
if (jsonObj.get("fulfillmentType") != null && !jsonObj.get("fulfillmentType").isJsonNull()) {
FulfillmentType.validateJsonElement(jsonObj.get("fulfillmentType"));
}
if ((jsonObj.get("orderLineItemId") != null && !jsonObj.get("orderLineItemId").isJsonNull()) && !jsonObj.get("orderLineItemId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `orderLineItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderLineItemId").toString()));
}
if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString()));
}
// validate the optional field `state`
if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) {
FulfillmentState.validateJsonElement(jsonObj.get("state"));
}
if ((jsonObj.get("trackingNumber") != null && !jsonObj.get("trackingNumber").isJsonNull()) && !jsonObj.get("trackingNumber").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `trackingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trackingNumber").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!UpdateFulfillmentRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UpdateFulfillmentRequest' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UpdateFulfillmentRequest.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, UpdateFulfillmentRequest 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 UpdateFulfillmentRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
UpdateFulfillmentRequest 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 UpdateFulfillmentRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of UpdateFulfillmentRequest
* @throws IOException if the JSON string is invalid with respect to UpdateFulfillmentRequest
*/
public static UpdateFulfillmentRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UpdateFulfillmentRequest.class);
}
/**
* Convert an instance of UpdateFulfillmentRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy