com.finbourne.access.model.IfExpression Maven / Gradle / Ivy
/*
* FINBOURNE Access Management 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.access.model;
import java.util.Objects;
import com.finbourne.access.model.IfFeatureChainExpression;
import com.finbourne.access.model.IfIdentityClaimExpression;
import com.finbourne.access.model.IfIdentityScopeExpression;
import com.finbourne.access.model.IfRequestHeaderExpression;
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.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.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.access.JSON;
/**
* IfExpression
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class IfExpression {
public static final String SERIALIZED_NAME_IF_REQUEST_HEADER_EXPRESSION = "ifRequestHeaderExpression";
@SerializedName(SERIALIZED_NAME_IF_REQUEST_HEADER_EXPRESSION)
private IfRequestHeaderExpression ifRequestHeaderExpression;
public static final String SERIALIZED_NAME_IF_IDENTITY_CLAIM_EXPRESSION = "ifIdentityClaimExpression";
@SerializedName(SERIALIZED_NAME_IF_IDENTITY_CLAIM_EXPRESSION)
private IfIdentityClaimExpression ifIdentityClaimExpression;
public static final String SERIALIZED_NAME_IF_IDENTITY_SCOPE_EXPRESSION = "ifIdentityScopeExpression";
@SerializedName(SERIALIZED_NAME_IF_IDENTITY_SCOPE_EXPRESSION)
private IfIdentityScopeExpression ifIdentityScopeExpression;
public static final String SERIALIZED_NAME_IF_FEATURE_CHAIN_EXPRESSION = "ifFeatureChainExpression";
@SerializedName(SERIALIZED_NAME_IF_FEATURE_CHAIN_EXPRESSION)
private IfFeatureChainExpression ifFeatureChainExpression;
public IfExpression() {
}
public IfExpression ifRequestHeaderExpression(IfRequestHeaderExpression ifRequestHeaderExpression) {
this.ifRequestHeaderExpression = ifRequestHeaderExpression;
return this;
}
/**
* Get ifRequestHeaderExpression
* @return ifRequestHeaderExpression
**/
@jakarta.annotation.Nullable
public IfRequestHeaderExpression getIfRequestHeaderExpression() {
return ifRequestHeaderExpression;
}
public void setIfRequestHeaderExpression(IfRequestHeaderExpression ifRequestHeaderExpression) {
this.ifRequestHeaderExpression = ifRequestHeaderExpression;
}
public IfExpression ifIdentityClaimExpression(IfIdentityClaimExpression ifIdentityClaimExpression) {
this.ifIdentityClaimExpression = ifIdentityClaimExpression;
return this;
}
/**
* Get ifIdentityClaimExpression
* @return ifIdentityClaimExpression
**/
@jakarta.annotation.Nullable
public IfIdentityClaimExpression getIfIdentityClaimExpression() {
return ifIdentityClaimExpression;
}
public void setIfIdentityClaimExpression(IfIdentityClaimExpression ifIdentityClaimExpression) {
this.ifIdentityClaimExpression = ifIdentityClaimExpression;
}
public IfExpression ifIdentityScopeExpression(IfIdentityScopeExpression ifIdentityScopeExpression) {
this.ifIdentityScopeExpression = ifIdentityScopeExpression;
return this;
}
/**
* Get ifIdentityScopeExpression
* @return ifIdentityScopeExpression
**/
@jakarta.annotation.Nullable
public IfIdentityScopeExpression getIfIdentityScopeExpression() {
return ifIdentityScopeExpression;
}
public void setIfIdentityScopeExpression(IfIdentityScopeExpression ifIdentityScopeExpression) {
this.ifIdentityScopeExpression = ifIdentityScopeExpression;
}
public IfExpression ifFeatureChainExpression(IfFeatureChainExpression ifFeatureChainExpression) {
this.ifFeatureChainExpression = ifFeatureChainExpression;
return this;
}
/**
* Get ifFeatureChainExpression
* @return ifFeatureChainExpression
**/
@jakarta.annotation.Nullable
public IfFeatureChainExpression getIfFeatureChainExpression() {
return ifFeatureChainExpression;
}
public void setIfFeatureChainExpression(IfFeatureChainExpression ifFeatureChainExpression) {
this.ifFeatureChainExpression = ifFeatureChainExpression;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IfExpression ifExpression = (IfExpression) o;
return Objects.equals(this.ifRequestHeaderExpression, ifExpression.ifRequestHeaderExpression) &&
Objects.equals(this.ifIdentityClaimExpression, ifExpression.ifIdentityClaimExpression) &&
Objects.equals(this.ifIdentityScopeExpression, ifExpression.ifIdentityScopeExpression) &&
Objects.equals(this.ifFeatureChainExpression, ifExpression.ifFeatureChainExpression);
}
@Override
public int hashCode() {
return Objects.hash(ifRequestHeaderExpression, ifIdentityClaimExpression, ifIdentityScopeExpression, ifFeatureChainExpression);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class IfExpression {\n");
sb.append(" ifRequestHeaderExpression: ").append(toIndentedString(ifRequestHeaderExpression)).append("\n");
sb.append(" ifIdentityClaimExpression: ").append(toIndentedString(ifIdentityClaimExpression)).append("\n");
sb.append(" ifIdentityScopeExpression: ").append(toIndentedString(ifIdentityScopeExpression)).append("\n");
sb.append(" ifFeatureChainExpression: ").append(toIndentedString(ifFeatureChainExpression)).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("ifRequestHeaderExpression");
openapiFields.add("ifIdentityClaimExpression");
openapiFields.add("ifIdentityScopeExpression");
openapiFields.add("ifFeatureChainExpression");
// 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 IfExpression
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!IfExpression.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in IfExpression is not found in the empty JSON string", IfExpression.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `ifRequestHeaderExpression`
if (jsonObj.get("ifRequestHeaderExpression") != null && !jsonObj.get("ifRequestHeaderExpression").isJsonNull()) {
IfRequestHeaderExpression.validateJsonElement(jsonObj.get("ifRequestHeaderExpression"));
}
// validate the optional field `ifIdentityClaimExpression`
if (jsonObj.get("ifIdentityClaimExpression") != null && !jsonObj.get("ifIdentityClaimExpression").isJsonNull()) {
IfIdentityClaimExpression.validateJsonElement(jsonObj.get("ifIdentityClaimExpression"));
}
// validate the optional field `ifIdentityScopeExpression`
if (jsonObj.get("ifIdentityScopeExpression") != null && !jsonObj.get("ifIdentityScopeExpression").isJsonNull()) {
IfIdentityScopeExpression.validateJsonElement(jsonObj.get("ifIdentityScopeExpression"));
}
// validate the optional field `ifFeatureChainExpression`
if (jsonObj.get("ifFeatureChainExpression") != null && !jsonObj.get("ifFeatureChainExpression").isJsonNull()) {
IfFeatureChainExpression.validateJsonElement(jsonObj.get("ifFeatureChainExpression"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!IfExpression.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'IfExpression' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(IfExpression.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, IfExpression value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public IfExpression read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of IfExpression given an JSON string
*
* @param jsonString JSON string
* @return An instance of IfExpression
* @throws IOException if the JSON string is invalid with respect to IfExpression
*/
public static IfExpression fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, IfExpression.class);
}
/**
* Convert an instance of IfExpression to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}