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.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;
/**
* Lightweight view of an user details
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class UserSummary {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_LOGIN = "login";
@SerializedName(SERIALIZED_NAME_LOGIN)
private String login;
public static final String SERIALIZED_NAME_EMAIL = "email";
@SerializedName(SERIALIZED_NAME_EMAIL)
private String email;
public static final String SERIALIZED_NAME_SECOND_EMAIL = "secondEmail";
@SerializedName(SERIALIZED_NAME_SECOND_EMAIL)
private String secondEmail;
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_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private String type;
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_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private List links;
public UserSummary() {
}
public UserSummary id(String id) {
this.id = id;
return this;
}
/**
* The user id
* @return id
**/
@jakarta.annotation.Nullable
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public UserSummary login(String login) {
this.login = login;
return this;
}
/**
* The user login
* @return login
**/
@jakarta.annotation.Nullable
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public UserSummary email(String email) {
this.email = email;
return this;
}
/**
* The email address registered for that user
* @return email
**/
@jakarta.annotation.Nullable
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public UserSummary secondEmail(String secondEmail) {
this.secondEmail = secondEmail;
return this;
}
/**
* Get secondEmail
* @return secondEmail
**/
@jakarta.annotation.Nullable
public String getSecondEmail() {
return secondEmail;
}
public void setSecondEmail(String secondEmail) {
this.secondEmail = secondEmail;
}
public UserSummary firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* User's first name
* @return firstName
**/
@jakarta.annotation.Nullable
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public UserSummary lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* User's last name
* @return lastName
**/
@jakarta.annotation.Nullable
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public UserSummary type(String type) {
this.type = type;
return this;
}
/**
* User's type (Personal, Service...)
* @return type
**/
@jakarta.annotation.Nullable
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public UserSummary alternativeUserIds(Map alternativeUserIds) {
this.alternativeUserIds = alternativeUserIds;
return this;
}
public UserSummary putAlternativeUserIdsItem(String key, String alternativeUserIdsItem) {
if (this.alternativeUserIds == null) {
this.alternativeUserIds = new HashMap<>();
}
this.alternativeUserIds.put(key, alternativeUserIdsItem);
return this;
}
/**
* User's alternative user IDs. Only returned for the current user
* @return alternativeUserIds
**/
@jakarta.annotation.Nullable
public Map getAlternativeUserIds() {
return alternativeUserIds;
}
public void setAlternativeUserIds(Map alternativeUserIds) {
this.alternativeUserIds = alternativeUserIds;
}
public UserSummary links(List links) {
this.links = links;
return this;
}
public UserSummary 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;
}
UserSummary userSummary = (UserSummary) o;
return Objects.equals(this.id, userSummary.id) &&
Objects.equals(this.login, userSummary.login) &&
Objects.equals(this.email, userSummary.email) &&
Objects.equals(this.secondEmail, userSummary.secondEmail) &&
Objects.equals(this.firstName, userSummary.firstName) &&
Objects.equals(this.lastName, userSummary.lastName) &&
Objects.equals(this.type, userSummary.type) &&
Objects.equals(this.alternativeUserIds, userSummary.alternativeUserIds) &&
Objects.equals(this.links, userSummary.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, login, email, secondEmail, firstName, lastName, type, alternativeUserIds, 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 UserSummary {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" login: ").append(toIndentedString(login)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" secondEmail: ").append(toIndentedString(secondEmail)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" alternativeUserIds: ").append(toIndentedString(alternativeUserIds)).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("login");
openapiFields.add("email");
openapiFields.add("secondEmail");
openapiFields.add("firstName");
openapiFields.add("lastName");
openapiFields.add("type");
openapiFields.add("alternativeUserIds");
openapiFields.add("links");
// 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 UserSummary
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UserSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UserSummary is not found in the empty JSON string", UserSummary.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
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("login") != null && !jsonObj.get("login").isJsonNull()) && !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("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
}
if ((jsonObj.get("secondEmail") != null && !jsonObj.get("secondEmail").isJsonNull()) && !jsonObj.get("secondEmail").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `secondEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secondEmail").toString()));
}
if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !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") != null && !jsonObj.get("lastName").isJsonNull()) && !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("type") != null && !jsonObj.get("type").isJsonNull()) && !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("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 (!UserSummary.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UserSummary' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UserSummary.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, UserSummary value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public UserSummary read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of UserSummary given an JSON string
*
* @param jsonString JSON string
* @return An instance of UserSummary
* @throws IOException if the JSON string is invalid with respect to UserSummary
*/
public static UserSummary fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UserSummary.class);
}
/**
* Convert an instance of UserSummary to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}