All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.finbourne.luminesce.model.FeedbackEventArgs Maven / Gradle / Ivy
/*
* FINBOURNE Luminesce Web API
*
* 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.finbourne.luminesce.model;
import java.util.Objects;
import com.finbourne.luminesce.model.FeedbackLevel;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import org.openapitools.jackson.nullable.JsonNullable;
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.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.finbourne.luminesce.JSON;
/**
* FeedbackEventArgs
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class FeedbackEventArgs {
public static final String SERIALIZED_NAME_WHEN = "when";
@SerializedName(SERIALIZED_NAME_WHEN)
private OffsetDateTime when;
public static final String SERIALIZED_NAME_SESSION_ID = "sessionId";
@SerializedName(SERIALIZED_NAME_SESSION_ID)
private UUID sessionId;
public static final String SERIALIZED_NAME_EXECUTION_ID = "executionId";
@SerializedName(SERIALIZED_NAME_EXECUTION_ID)
private UUID executionId;
public static final String SERIALIZED_NAME_LEVEL = "level";
@SerializedName(SERIALIZED_NAME_LEVEL)
private FeedbackLevel level;
public static final String SERIALIZED_NAME_SENDER = "sender";
@SerializedName(SERIALIZED_NAME_SENDER)
private String sender;
public static final String SERIALIZED_NAME_STATE_ID = "stateId";
@SerializedName(SERIALIZED_NAME_STATE_ID)
private Integer stateId;
public static final String SERIALIZED_NAME_MESSAGE_TEMPLATE = "messageTemplate";
@SerializedName(SERIALIZED_NAME_MESSAGE_TEMPLATE)
private String messageTemplate;
public static final String SERIALIZED_NAME_PROPERTY_VALUES = "propertyValues";
@SerializedName(SERIALIZED_NAME_PROPERTY_VALUES)
private List propertyValues;
public static final String SERIALIZED_NAME_MESSAGE = "message";
@SerializedName(SERIALIZED_NAME_MESSAGE)
private String message;
public FeedbackEventArgs() {
}
public FeedbackEventArgs(
String message
) {
this();
this.message = message;
}
public FeedbackEventArgs when(OffsetDateTime when) {
this.when = when;
return this;
}
/**
* Get when
* @return when
**/
@jakarta.annotation.Nullable
public OffsetDateTime getWhen() {
return when;
}
public void setWhen(OffsetDateTime when) {
this.when = when;
}
public FeedbackEventArgs sessionId(UUID sessionId) {
this.sessionId = sessionId;
return this;
}
/**
* Get sessionId
* @return sessionId
**/
@jakarta.annotation.Nullable
public UUID getSessionId() {
return sessionId;
}
public void setSessionId(UUID sessionId) {
this.sessionId = sessionId;
}
public FeedbackEventArgs executionId(UUID executionId) {
this.executionId = executionId;
return this;
}
/**
* Get executionId
* @return executionId
**/
@jakarta.annotation.Nullable
public UUID getExecutionId() {
return executionId;
}
public void setExecutionId(UUID executionId) {
this.executionId = executionId;
}
public FeedbackEventArgs level(FeedbackLevel level) {
this.level = level;
return this;
}
/**
* Get level
* @return level
**/
@jakarta.annotation.Nullable
public FeedbackLevel getLevel() {
return level;
}
public void setLevel(FeedbackLevel level) {
this.level = level;
}
public FeedbackEventArgs sender(String sender) {
this.sender = sender;
return this;
}
/**
* Get sender
* @return sender
**/
@jakarta.annotation.Nullable
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public FeedbackEventArgs stateId(Integer stateId) {
this.stateId = stateId;
return this;
}
/**
* Get stateId
* @return stateId
**/
@jakarta.annotation.Nullable
public Integer getStateId() {
return stateId;
}
public void setStateId(Integer stateId) {
this.stateId = stateId;
}
public FeedbackEventArgs messageTemplate(String messageTemplate) {
this.messageTemplate = messageTemplate;
return this;
}
/**
* Get messageTemplate
* @return messageTemplate
**/
@jakarta.annotation.Nullable
public String getMessageTemplate() {
return messageTemplate;
}
public void setMessageTemplate(String messageTemplate) {
this.messageTemplate = messageTemplate;
}
public FeedbackEventArgs propertyValues(List propertyValues) {
this.propertyValues = propertyValues;
return this;
}
public FeedbackEventArgs addPropertyValuesItem(Object propertyValuesItem) {
if (this.propertyValues == null) {
this.propertyValues = new ArrayList<>();
}
this.propertyValues.add(propertyValuesItem);
return this;
}
/**
* Get propertyValues
* @return propertyValues
**/
@jakarta.annotation.Nullable
public List getPropertyValues() {
return propertyValues;
}
public void setPropertyValues(List propertyValues) {
this.propertyValues = propertyValues;
}
/**
* Get message
* @return message
**/
@jakarta.annotation.Nullable
public String getMessage() {
return message;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FeedbackEventArgs feedbackEventArgs = (FeedbackEventArgs) o;
return Objects.equals(this.when, feedbackEventArgs.when) &&
Objects.equals(this.sessionId, feedbackEventArgs.sessionId) &&
Objects.equals(this.executionId, feedbackEventArgs.executionId) &&
Objects.equals(this.level, feedbackEventArgs.level) &&
Objects.equals(this.sender, feedbackEventArgs.sender) &&
Objects.equals(this.stateId, feedbackEventArgs.stateId) &&
Objects.equals(this.messageTemplate, feedbackEventArgs.messageTemplate) &&
Objects.equals(this.propertyValues, feedbackEventArgs.propertyValues) &&
Objects.equals(this.message, feedbackEventArgs.message);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(when, sessionId, executionId, level, sender, stateId, messageTemplate, propertyValues, message);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FeedbackEventArgs {\n");
sb.append(" when: ").append(toIndentedString(when)).append("\n");
sb.append(" sessionId: ").append(toIndentedString(sessionId)).append("\n");
sb.append(" executionId: ").append(toIndentedString(executionId)).append("\n");
sb.append(" level: ").append(toIndentedString(level)).append("\n");
sb.append(" sender: ").append(toIndentedString(sender)).append("\n");
sb.append(" stateId: ").append(toIndentedString(stateId)).append("\n");
sb.append(" messageTemplate: ").append(toIndentedString(messageTemplate)).append("\n");
sb.append(" propertyValues: ").append(toIndentedString(propertyValues)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).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("when");
openapiFields.add("sessionId");
openapiFields.add("executionId");
openapiFields.add("level");
openapiFields.add("sender");
openapiFields.add("stateId");
openapiFields.add("messageTemplate");
openapiFields.add("propertyValues");
openapiFields.add("message");
// 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 FeedbackEventArgs
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!FeedbackEventArgs.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in FeedbackEventArgs is not found in the empty JSON string", FeedbackEventArgs.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("sessionId") != null && !jsonObj.get("sessionId").isJsonNull()) && !jsonObj.get("sessionId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `sessionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sessionId").toString()));
}
if ((jsonObj.get("executionId") != null && !jsonObj.get("executionId").isJsonNull()) && !jsonObj.get("executionId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `executionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("executionId").toString()));
}
if ((jsonObj.get("sender") != null && !jsonObj.get("sender").isJsonNull()) && !jsonObj.get("sender").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `sender` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sender").toString()));
}
if ((jsonObj.get("messageTemplate") != null && !jsonObj.get("messageTemplate").isJsonNull()) && !jsonObj.get("messageTemplate").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `messageTemplate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageTemplate").toString()));
}
// ensure the optional json data is an array if present
if (jsonObj.get("propertyValues") != null && !jsonObj.get("propertyValues").isJsonNull() && !jsonObj.get("propertyValues").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `propertyValues` to be an array in the JSON string but got `%s`", jsonObj.get("propertyValues").toString()));
}
if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!FeedbackEventArgs.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'FeedbackEventArgs' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(FeedbackEventArgs.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, FeedbackEventArgs value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public FeedbackEventArgs read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of FeedbackEventArgs given an JSON string
*
* @param jsonString JSON string
* @return An instance of FeedbackEventArgs
* @throws IOException if the JSON string is invalid with respect to FeedbackEventArgs
*/
public static FeedbackEventArgs fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, FeedbackEventArgs.class);
}
/**
* Convert an instance of FeedbackEventArgs to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}