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.
/*
* FINBOURNE Identity Service 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.identity.model;
import java.util.Objects;
import com.finbourne.identity.model.RoleId;
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 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.identity.JSON;
/**
* RoleResponse
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class RoleResponse {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_ROLE_ID = "roleId";
@SerializedName(SERIALIZED_NAME_ROLE_ID)
private RoleId roleId;
public static final String SERIALIZED_NAME_SOURCE = "source";
@SerializedName(SERIALIZED_NAME_SOURCE)
private String source;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
private String description;
public static final String SERIALIZED_NAME_SAML_NAME = "samlName";
@SerializedName(SERIALIZED_NAME_SAML_NAME)
private String samlName;
public RoleResponse() {
}
public RoleResponse id(String id) {
this.id = id;
return this;
}
/**
* The role's system supplied unique identifier
* @return id
**/
@jakarta.annotation.Nonnull
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public RoleResponse roleId(RoleId roleId) {
this.roleId = roleId;
return this;
}
/**
* Get roleId
* @return roleId
**/
@jakarta.annotation.Nonnull
public RoleId getRoleId() {
return roleId;
}
public void setRoleId(RoleId roleId) {
this.roleId = roleId;
}
public RoleResponse source(String source) {
this.source = source;
return this;
}
/**
* The source of the role
* @return source
**/
@jakarta.annotation.Nonnull
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public RoleResponse name(String name) {
this.name = name;
return this;
}
/**
* The role name, which must be unique within the system.
* @return name
**/
@jakarta.annotation.Nonnull
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public RoleResponse description(String description) {
this.description = description;
return this;
}
/**
* The description for this role
* @return description
**/
@jakarta.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public RoleResponse samlName(String samlName) {
this.samlName = samlName;
return this;
}
/**
* The name to use on the SAML request if assigning this role via SAML Just in Time (JIT)
* @return samlName
**/
@jakarta.annotation.Nullable
public String getSamlName() {
return samlName;
}
public void setSamlName(String samlName) {
this.samlName = samlName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RoleResponse roleResponse = (RoleResponse) o;
return Objects.equals(this.id, roleResponse.id) &&
Objects.equals(this.roleId, roleResponse.roleId) &&
Objects.equals(this.source, roleResponse.source) &&
Objects.equals(this.name, roleResponse.name) &&
Objects.equals(this.description, roleResponse.description) &&
Objects.equals(this.samlName, roleResponse.samlName);
}
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(id, roleId, source, name, description, samlName);
}
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 RoleResponse {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" roleId: ").append(toIndentedString(roleId)).append("\n");
sb.append(" source: ").append(toIndentedString(source)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" samlName: ").append(toIndentedString(samlName)).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("id");
openapiFields.add("roleId");
openapiFields.add("source");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("samlName");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("id");
openapiRequiredFields.add("roleId");
openapiRequiredFields.add("source");
openapiRequiredFields.add("name");
}
/**
* 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 RoleResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RoleResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RoleResponse is not found in the empty JSON string", RoleResponse.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : RoleResponse.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if (!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()));
}
// validate the required field `roleId`
RoleId.validateJsonElement(jsonObj.get("roleId"));
if (!jsonObj.get("source").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString()));
}
if (!jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").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("samlName") != null && !jsonObj.get("samlName").isJsonNull()) && !jsonObj.get("samlName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `samlName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("samlName").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!RoleResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RoleResponse' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RoleResponse.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, RoleResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public RoleResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of RoleResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of RoleResponse
* @throws IOException if the JSON string is invalid with respect to RoleResponse
*/
public static RoleResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RoleResponse.class);
}
/**
* Convert an instance of RoleResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}