com.zuora.model.MigrationComponentContent 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 java.io.IOException;
import java.time.OffsetDateTime;
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;
/**
* When a comparison is made between a source and target tenant, it sends a response to the user interface.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class MigrationComponentContent {
public static final String SERIALIZED_NAME_ATTRIBUTE = "attribute";
@SerializedName(SERIALIZED_NAME_ATTRIBUTE)
private String attribute;
public static final String SERIALIZED_NAME_COMPONENT_TYPE = "componentType";
@SerializedName(SERIALIZED_NAME_COMPONENT_TYPE)
private String componentType;
public static final String SERIALIZED_NAME_CURRENT_TARGET_RESPONSE = "currentTargetResponse";
@SerializedName(SERIALIZED_NAME_CURRENT_TARGET_RESPONSE)
private Object currentTargetResponse;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
private String description;
public static final String SERIALIZED_NAME_DISABLED = "disabled";
@SerializedName(SERIALIZED_NAME_DISABLED)
private String disabled;
public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage";
@SerializedName(SERIALIZED_NAME_ERROR_MESSAGE)
private String errorMessage;
public static final String SERIALIZED_NAME_HTTP_METHODS = "httpMethods";
@SerializedName(SERIALIZED_NAME_HTTP_METHODS)
private String httpMethods;
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_KEY = "key";
@SerializedName(SERIALIZED_NAME_KEY)
private String key;
public static final String SERIALIZED_NAME_MIGRATED_ON = "migratedOn";
@SerializedName(SERIALIZED_NAME_MIGRATED_ON)
private OffsetDateTime migratedOn;
public static final String SERIALIZED_NAME_MIGRATION_ID = "migrationId";
@SerializedName(SERIALIZED_NAME_MIGRATION_ID)
private String migrationId;
public static final String SERIALIZED_NAME_PATH_PATTERN = "pathPattern";
@SerializedName(SERIALIZED_NAME_PATH_PATTERN)
private String pathPattern;
public static final String SERIALIZED_NAME_PREVIOUS_TARGET_RESPONSE = "previousTargetResponse";
@SerializedName(SERIALIZED_NAME_PREVIOUS_TARGET_RESPONSE)
private Object previousTargetResponse;
public static final String SERIALIZED_NAME_RESULT = "result";
@SerializedName(SERIALIZED_NAME_RESULT)
private String result;
public static final String SERIALIZED_NAME_SEGREGATION_KEY = "segregationKey";
@SerializedName(SERIALIZED_NAME_SEGREGATION_KEY)
private String segregationKey;
public static final String SERIALIZED_NAME_SOURCE_RESPONSE = "sourceResponse";
@SerializedName(SERIALIZED_NAME_SOURCE_RESPONSE)
private Object sourceResponse;
public static final String SERIALIZED_NAME_STATUS = "status";
@SerializedName(SERIALIZED_NAME_STATUS)
private String status;
public static final String SERIALIZED_NAME_UPDATE_STATUS = "updateStatus";
@SerializedName(SERIALIZED_NAME_UPDATE_STATUS)
private String updateStatus;
public MigrationComponentContent() {
}
public MigrationComponentContent attribute(String attribute) {
this.attribute = attribute;
return this;
}
/**
* Get attribute
* @return attribute
*/
@javax.annotation.Nullable
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
public MigrationComponentContent componentType(String componentType) {
this.componentType = componentType;
return this;
}
/**
* Type of selected components to be migrated.
* @return componentType
*/
@javax.annotation.Nullable
public String getComponentType() {
return componentType;
}
public void setComponentType(String componentType) {
this.componentType = componentType;
}
public MigrationComponentContent currentTargetResponse(Object currentTargetResponse) {
this.currentTargetResponse = currentTargetResponse;
return this;
}
/**
* Json node object contains metadata.
* @return currentTargetResponse
*/
@javax.annotation.Nullable
public Object getCurrentTargetResponse() {
return currentTargetResponse;
}
public void setCurrentTargetResponse(Object currentTargetResponse) {
this.currentTargetResponse = currentTargetResponse;
}
public MigrationComponentContent description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public MigrationComponentContent disabled(String disabled) {
this.disabled = disabled;
return this;
}
/**
* Get disabled
* @return disabled
*/
@javax.annotation.Nullable
public String getDisabled() {
return disabled;
}
public void setDisabled(String disabled) {
this.disabled = disabled;
}
public MigrationComponentContent errorMessage(String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
/**
* Error information.
* @return errorMessage
*/
@javax.annotation.Nullable
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public MigrationComponentContent httpMethods(String httpMethods) {
this.httpMethods = httpMethods;
return this;
}
/**
* Get httpMethods
* @return httpMethods
*/
@javax.annotation.Nullable
public String getHttpMethods() {
return httpMethods;
}
public void setHttpMethods(String httpMethods) {
this.httpMethods = httpMethods;
}
public MigrationComponentContent id(String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public MigrationComponentContent key(String key) {
this.key = key;
return this;
}
/**
* Get key
* @return key
*/
@javax.annotation.Nullable
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public MigrationComponentContent migratedOn(OffsetDateTime migratedOn) {
this.migratedOn = migratedOn;
return this;
}
/**
* It is the time when migration is triggered.
* @return migratedOn
*/
@javax.annotation.Nullable
public OffsetDateTime getMigratedOn() {
return migratedOn;
}
public void setMigratedOn(OffsetDateTime migratedOn) {
this.migratedOn = migratedOn;
}
public MigrationComponentContent migrationId(String migrationId) {
this.migrationId = migrationId;
return this;
}
/**
* Migration ID. It is generated at the time of triggering deployment.
* @return migrationId
*/
@javax.annotation.Nullable
public String getMigrationId() {
return migrationId;
}
public void setMigrationId(String migrationId) {
this.migrationId = migrationId;
}
public MigrationComponentContent pathPattern(String pathPattern) {
this.pathPattern = pathPattern;
return this;
}
/**
* PathPattern of component.
* @return pathPattern
*/
@javax.annotation.Nullable
public String getPathPattern() {
return pathPattern;
}
public void setPathPattern(String pathPattern) {
this.pathPattern = pathPattern;
}
public MigrationComponentContent previousTargetResponse(Object previousTargetResponse) {
this.previousTargetResponse = previousTargetResponse;
return this;
}
/**
* Json node object contains metadata.
* @return previousTargetResponse
*/
@javax.annotation.Nullable
public Object getPreviousTargetResponse() {
return previousTargetResponse;
}
public void setPreviousTargetResponse(Object previousTargetResponse) {
this.previousTargetResponse = previousTargetResponse;
}
public MigrationComponentContent result(String result) {
this.result = result;
return this;
}
/**
* Returns the result details of Components.
* @return result
*/
@javax.annotation.Nullable
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public MigrationComponentContent segregationKey(String segregationKey) {
this.segregationKey = segregationKey;
return this;
}
/**
* Displays the differences between components.
* @return segregationKey
*/
@javax.annotation.Nullable
public String getSegregationKey() {
return segregationKey;
}
public void setSegregationKey(String segregationKey) {
this.segregationKey = segregationKey;
}
public MigrationComponentContent sourceResponse(Object sourceResponse) {
this.sourceResponse = sourceResponse;
return this;
}
/**
* Json node object contains metadata.
* @return sourceResponse
*/
@javax.annotation.Nullable
public Object getSourceResponse() {
return sourceResponse;
}
public void setSourceResponse(Object sourceResponse) {
this.sourceResponse = sourceResponse;
}
public MigrationComponentContent status(String status) {
this.status = status;
return this;
}
/**
* Returns the status of each component.
* @return status
*/
@javax.annotation.Nullable
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public MigrationComponentContent updateStatus(String updateStatus) {
this.updateStatus = updateStatus;
return this;
}
/**
* Updated Status.
* @return updateStatus
*/
@javax.annotation.Nullable
public String getUpdateStatus() {
return updateStatus;
}
public void setUpdateStatus(String updateStatus) {
this.updateStatus = updateStatus;
}
/**
* 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 MigrationComponentContent instance itself
*/
public MigrationComponentContent 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;
}
MigrationComponentContent migrationComponentContent = (MigrationComponentContent) o;
return Objects.equals(this.attribute, migrationComponentContent.attribute) &&
Objects.equals(this.componentType, migrationComponentContent.componentType) &&
Objects.equals(this.currentTargetResponse, migrationComponentContent.currentTargetResponse) &&
Objects.equals(this.description, migrationComponentContent.description) &&
Objects.equals(this.disabled, migrationComponentContent.disabled) &&
Objects.equals(this.errorMessage, migrationComponentContent.errorMessage) &&
Objects.equals(this.httpMethods, migrationComponentContent.httpMethods) &&
Objects.equals(this.id, migrationComponentContent.id) &&
Objects.equals(this.key, migrationComponentContent.key) &&
Objects.equals(this.migratedOn, migrationComponentContent.migratedOn) &&
Objects.equals(this.migrationId, migrationComponentContent.migrationId) &&
Objects.equals(this.pathPattern, migrationComponentContent.pathPattern) &&
Objects.equals(this.previousTargetResponse, migrationComponentContent.previousTargetResponse) &&
Objects.equals(this.result, migrationComponentContent.result) &&
Objects.equals(this.segregationKey, migrationComponentContent.segregationKey) &&
Objects.equals(this.sourceResponse, migrationComponentContent.sourceResponse) &&
Objects.equals(this.status, migrationComponentContent.status) &&
Objects.equals(this.updateStatus, migrationComponentContent.updateStatus)&&
Objects.equals(this.additionalProperties, migrationComponentContent.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(attribute, componentType, currentTargetResponse, description, disabled, errorMessage, httpMethods, id, key, migratedOn, migrationId, pathPattern, previousTargetResponse, result, segregationKey, sourceResponse, status, updateStatus, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MigrationComponentContent {\n");
sb.append(" attribute: ").append(toIndentedString(attribute)).append("\n");
sb.append(" componentType: ").append(toIndentedString(componentType)).append("\n");
sb.append(" currentTargetResponse: ").append(toIndentedString(currentTargetResponse)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" disabled: ").append(toIndentedString(disabled)).append("\n");
sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n");
sb.append(" httpMethods: ").append(toIndentedString(httpMethods)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" key: ").append(toIndentedString(key)).append("\n");
sb.append(" migratedOn: ").append(toIndentedString(migratedOn)).append("\n");
sb.append(" migrationId: ").append(toIndentedString(migrationId)).append("\n");
sb.append(" pathPattern: ").append(toIndentedString(pathPattern)).append("\n");
sb.append(" previousTargetResponse: ").append(toIndentedString(previousTargetResponse)).append("\n");
sb.append(" result: ").append(toIndentedString(result)).append("\n");
sb.append(" segregationKey: ").append(toIndentedString(segregationKey)).append("\n");
sb.append(" sourceResponse: ").append(toIndentedString(sourceResponse)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" updateStatus: ").append(toIndentedString(updateStatus)).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("attribute");
openapiFields.add("componentType");
openapiFields.add("currentTargetResponse");
openapiFields.add("description");
openapiFields.add("disabled");
openapiFields.add("errorMessage");
openapiFields.add("httpMethods");
openapiFields.add("id");
openapiFields.add("key");
openapiFields.add("migratedOn");
openapiFields.add("migrationId");
openapiFields.add("pathPattern");
openapiFields.add("previousTargetResponse");
openapiFields.add("result");
openapiFields.add("segregationKey");
openapiFields.add("sourceResponse");
openapiFields.add("status");
openapiFields.add("updateStatus");
// 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 MigrationComponentContent
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!MigrationComponentContent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in MigrationComponentContent is not found in the empty JSON string", MigrationComponentContent.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("attribute") != null && !jsonObj.get("attribute").isJsonNull()) && !jsonObj.get("attribute").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `attribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute").toString()));
}
if ((jsonObj.get("componentType") != null && !jsonObj.get("componentType").isJsonNull()) && !jsonObj.get("componentType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `componentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("componentType").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("disabled") != null && !jsonObj.get("disabled").isJsonNull()) && !jsonObj.get("disabled").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `disabled` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disabled").toString()));
}
if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString()));
}
if ((jsonObj.get("httpMethods") != null && !jsonObj.get("httpMethods").isJsonNull()) && !jsonObj.get("httpMethods").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `httpMethods` to be a primitive type in the JSON string but got `%s`", jsonObj.get("httpMethods").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("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString()));
}
if ((jsonObj.get("migrationId") != null && !jsonObj.get("migrationId").isJsonNull()) && !jsonObj.get("migrationId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `migrationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("migrationId").toString()));
}
if ((jsonObj.get("pathPattern") != null && !jsonObj.get("pathPattern").isJsonNull()) && !jsonObj.get("pathPattern").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `pathPattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pathPattern").toString()));
}
if ((jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) && !jsonObj.get("result").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `result` to be a primitive type in the JSON string but got `%s`", jsonObj.get("result").toString()));
}
if ((jsonObj.get("segregationKey") != null && !jsonObj.get("segregationKey").isJsonNull()) && !jsonObj.get("segregationKey").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `segregationKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("segregationKey").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("updateStatus") != null && !jsonObj.get("updateStatus").isJsonNull()) && !jsonObj.get("updateStatus").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `updateStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updateStatus").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!MigrationComponentContent.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'MigrationComponentContent' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(MigrationComponentContent.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, MigrationComponentContent 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 MigrationComponentContent read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
MigrationComponentContent 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 MigrationComponentContent given an JSON string
*
* @param jsonString JSON string
* @return An instance of MigrationComponentContent
* @throws IOException if the JSON string is invalid with respect to MigrationComponentContent
*/
public static MigrationComponentContent fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, MigrationComponentContent.class);
}
/**
* Convert an instance of MigrationComponentContent to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy