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.Link;
import com.finbourne.identity.model.RoleResponse;
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.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
* UserResponse
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class UserResponse {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_ALTERNATIVE_USER_IDS = "alternativeUserIds";
@SerializedName(SERIALIZED_NAME_ALTERNATIVE_USER_IDS)
private Map alternativeUserIds;
public static final String SERIALIZED_NAME_EMAIL_ADDRESS = "emailAddress";
@SerializedName(SERIALIZED_NAME_EMAIL_ADDRESS)
private String emailAddress;
public static final String SERIALIZED_NAME_SECOND_EMAIL_ADDRESS = "secondEmailAddress";
@SerializedName(SERIALIZED_NAME_SECOND_EMAIL_ADDRESS)
private String secondEmailAddress;
public static final String SERIALIZED_NAME_LOGIN = "login";
@SerializedName(SERIALIZED_NAME_LOGIN)
private String login;
public static final String SERIALIZED_NAME_FIRST_NAME = "firstName";
@SerializedName(SERIALIZED_NAME_FIRST_NAME)
private String firstName;
public static final String SERIALIZED_NAME_LAST_NAME = "lastName";
@SerializedName(SERIALIZED_NAME_LAST_NAME)
private String lastName;
public static final String SERIALIZED_NAME_ROLES = "roles";
@SerializedName(SERIALIZED_NAME_ROLES)
private List roles;
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private String type;
public static final String SERIALIZED_NAME_STATUS = "status";
@SerializedName(SERIALIZED_NAME_STATUS)
private String status;
public static final String SERIALIZED_NAME_EXTERNAL = "external";
@SerializedName(SERIALIZED_NAME_EXTERNAL)
private Boolean external;
public static final String SERIALIZED_NAME_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private List links;
public UserResponse() {
}
public UserResponse id(String id) {
this.id = id;
return this;
}
/**
* The user's system supplied unique identifier
* @return id
**/
@jakarta.annotation.Nonnull
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public UserResponse alternativeUserIds(Map alternativeUserIds) {
this.alternativeUserIds = alternativeUserIds;
return this;
}
public UserResponse putAlternativeUserIdsItem(String key, String alternativeUserIdsItem) {
if (this.alternativeUserIds == null) {
this.alternativeUserIds = new HashMap<>();
}
this.alternativeUserIds.put(key, alternativeUserIdsItem);
return this;
}
/**
* The user's alternative IDs
* @return alternativeUserIds
**/
@jakarta.annotation.Nullable
public Map getAlternativeUserIds() {
return alternativeUserIds;
}
public void setAlternativeUserIds(Map alternativeUserIds) {
this.alternativeUserIds = alternativeUserIds;
}
public UserResponse emailAddress(String emailAddress) {
this.emailAddress = emailAddress;
return this;
}
/**
* The user's emailAddress address, which must be unique within the system
* @return emailAddress
**/
@jakarta.annotation.Nonnull
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public UserResponse secondEmailAddress(String secondEmailAddress) {
this.secondEmailAddress = secondEmailAddress;
return this;
}
/**
* The user's second email address. Only allowed for service users.
* @return secondEmailAddress
**/
@jakarta.annotation.Nullable
public String getSecondEmailAddress() {
return secondEmailAddress;
}
public void setSecondEmailAddress(String secondEmailAddress) {
this.secondEmailAddress = secondEmailAddress;
}
public UserResponse login(String login) {
this.login = login;
return this;
}
/**
* Get login
* @return login
**/
@jakarta.annotation.Nonnull
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public UserResponse firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* The user's first name
* @return firstName
**/
@jakarta.annotation.Nonnull
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public UserResponse lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* The user's last name
* @return lastName
**/
@jakarta.annotation.Nonnull
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public UserResponse roles(List roles) {
this.roles = roles;
return this;
}
public UserResponse addRolesItem(RoleResponse rolesItem) {
if (this.roles == null) {
this.roles = new ArrayList<>();
}
this.roles.add(rolesItem);
return this;
}
/**
* The roles that the user has.
* @return roles
**/
@jakarta.annotation.Nullable
public List getRoles() {
return roles;
}
public void setRoles(List roles) {
this.roles = roles;
}
public UserResponse type(String type) {
this.type = type;
return this;
}
/**
* The type of user (e.g. Personal or Service)
* @return type
**/
@jakarta.annotation.Nonnull
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public UserResponse status(String status) {
this.status = status;
return this;
}
/**
* The status of the user
* @return status
**/
@jakarta.annotation.Nonnull
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public UserResponse external(Boolean external) {
this.external = external;
return this;
}
/**
* Whether or not the user originates from an external identity system
* @return external
**/
@jakarta.annotation.Nonnull
public Boolean getExternal() {
return external;
}
public void setExternal(Boolean external) {
this.external = external;
}
public UserResponse links(List links) {
this.links = links;
return this;
}
public UserResponse addLinksItem(Link linksItem) {
if (this.links == null) {
this.links = new ArrayList<>();
}
this.links.add(linksItem);
return this;
}
/**
* Get links
* @return links
**/
@jakarta.annotation.Nullable
public List getLinks() {
return links;
}
public void setLinks(List links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserResponse userResponse = (UserResponse) o;
return Objects.equals(this.id, userResponse.id) &&
Objects.equals(this.alternativeUserIds, userResponse.alternativeUserIds) &&
Objects.equals(this.emailAddress, userResponse.emailAddress) &&
Objects.equals(this.secondEmailAddress, userResponse.secondEmailAddress) &&
Objects.equals(this.login, userResponse.login) &&
Objects.equals(this.firstName, userResponse.firstName) &&
Objects.equals(this.lastName, userResponse.lastName) &&
Objects.equals(this.roles, userResponse.roles) &&
Objects.equals(this.type, userResponse.type) &&
Objects.equals(this.status, userResponse.status) &&
Objects.equals(this.external, userResponse.external) &&
Objects.equals(this.links, userResponse.links);
}
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, alternativeUserIds, emailAddress, secondEmailAddress, login, firstName, lastName, roles, type, status, external, links);
}
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 UserResponse {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" alternativeUserIds: ").append(toIndentedString(alternativeUserIds)).append("\n");
sb.append(" emailAddress: ").append(toIndentedString(emailAddress)).append("\n");
sb.append(" secondEmailAddress: ").append(toIndentedString(secondEmailAddress)).append("\n");
sb.append(" login: ").append(toIndentedString(login)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" roles: ").append(toIndentedString(roles)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" external: ").append(toIndentedString(external)).append("\n");
sb.append(" links: ").append(toIndentedString(links)).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("alternativeUserIds");
openapiFields.add("emailAddress");
openapiFields.add("secondEmailAddress");
openapiFields.add("login");
openapiFields.add("firstName");
openapiFields.add("lastName");
openapiFields.add("roles");
openapiFields.add("type");
openapiFields.add("status");
openapiFields.add("external");
openapiFields.add("links");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("id");
openapiRequiredFields.add("emailAddress");
openapiRequiredFields.add("login");
openapiRequiredFields.add("firstName");
openapiRequiredFields.add("lastName");
openapiRequiredFields.add("type");
openapiRequiredFields.add("status");
openapiRequiredFields.add("external");
}
/**
* 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 UserResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UserResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UserResponse is not found in the empty JSON string", UserResponse.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : UserResponse.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()));
}
if (!jsonObj.get("emailAddress").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `emailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("emailAddress").toString()));
}
if ((jsonObj.get("secondEmailAddress") != null && !jsonObj.get("secondEmailAddress").isJsonNull()) && !jsonObj.get("secondEmailAddress").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `secondEmailAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secondEmailAddress").toString()));
}
if (!jsonObj.get("login").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString()));
}
if (!jsonObj.get("firstName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString()));
}
if (!jsonObj.get("lastName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString()));
}
if (jsonObj.get("roles") != null && !jsonObj.get("roles").isJsonNull()) {
JsonArray jsonArrayroles = jsonObj.getAsJsonArray("roles");
if (jsonArrayroles != null) {
// ensure the json data is an array
if (!jsonObj.get("roles").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `roles` to be an array in the JSON string but got `%s`", jsonObj.get("roles").toString()));
}
// validate the optional field `roles` (array)
for (int i = 0; i < jsonArrayroles.size(); i++) {
RoleResponse.validateJsonElement(jsonArrayroles.get(i));
};
}
}
if (!jsonObj.get("type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
}
if (!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("links") != null && !jsonObj.get("links").isJsonNull()) {
JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links");
if (jsonArraylinks != null) {
// ensure the json data is an array
if (!jsonObj.get("links").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString()));
}
// validate the optional field `links` (array)
for (int i = 0; i < jsonArraylinks.size(); i++) {
Link.validateJsonElement(jsonArraylinks.get(i));
};
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!UserResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UserResponse' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UserResponse.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, UserResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public UserResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of UserResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of UserResponse
* @throws IOException if the JSON string is invalid with respect to UserResponse
*/
public static UserResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UserResponse.class);
}
/**
* Convert an instance of UserResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}