software.tnb.jira.validation.generated.model.ProjectRoleActorsUpdateBean Maven / Gradle / Ivy
/*
* The Jira Cloud platform REST API
* Jira Cloud platform REST API documentation
*
* The version of the OpenAPI document: 1001.0.0-SNAPSHOT
* 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 software.tnb.jira.validation.generated.model;
import java.util.Objects;
import java.util.Arrays;
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.HashMap;
import java.util.List;
import java.util.Map;
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 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 software.tnb.jira.validation.generated.JSON;
/**
* ProjectRoleActorsUpdateBean
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-04-19T08:25:23.439913Z[Etc/UTC]")
public class ProjectRoleActorsUpdateBean {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private Long id;
public static final String SERIALIZED_NAME_CATEGORISED_ACTORS = "categorisedActors";
@SerializedName(SERIALIZED_NAME_CATEGORISED_ACTORS)
private Map> categorisedActors = new HashMap<>();
public ProjectRoleActorsUpdateBean() {
}
public ProjectRoleActorsUpdateBean(
Long id
) {
this();
this.id = id;
}
/**
* The ID of the project role. Use [Get all project roles](#api-rest-api-3-role-get) to get a list of project role IDs.
* @return id
**/
@jakarta.annotation.Nullable
public Long getId() {
return id;
}
public ProjectRoleActorsUpdateBean categorisedActors(Map> categorisedActors) {
this.categorisedActors = categorisedActors;
return this;
}
public ProjectRoleActorsUpdateBean putCategorisedActorsItem(String key, List categorisedActorsItem) {
if (this.categorisedActors == null) {
this.categorisedActors = new HashMap<>();
}
this.categorisedActors.put(key, categorisedActorsItem);
return this;
}
/**
* The actors to add to the project role. Add groups using: * `atlassian-group-role-actor` and a list of group names. * `atlassian-group-role-actor-id` and a list of group IDs. As a group's name can change, use of `atlassian-group-role-actor-id` is recommended. For example, `\"atlassian-group-role-actor-id\":[\"eef79f81-0b89-4fca-a736-4be531a10869\",\"77f6ab39-e755-4570-a6ae-2d7a8df0bcb8\"]`. Add users using `atlassian-user-role-actor` and a list of account IDs. For example, `\"atlassian-user-role-actor\":[\"12345678-9abc-def1-2345-6789abcdef12\", \"abcdef12-3456-789a-bcde-f123456789ab\"]`.
* @return categorisedActors
**/
@jakarta.annotation.Nullable
public Map> getCategorisedActors() {
return categorisedActors;
}
public void setCategorisedActors(Map> categorisedActors) {
this.categorisedActors = categorisedActors;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProjectRoleActorsUpdateBean projectRoleActorsUpdateBean = (ProjectRoleActorsUpdateBean) o;
return Objects.equals(this.id, projectRoleActorsUpdateBean.id) &&
Objects.equals(this.categorisedActors, projectRoleActorsUpdateBean.categorisedActors);
}
@Override
public int hashCode() {
return Objects.hash(id, categorisedActors);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ProjectRoleActorsUpdateBean {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" categorisedActors: ").append(toIndentedString(categorisedActors)).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("categorisedActors");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Object and throws an exception if issues found
*
* @param jsonObj JSON Object
* @throws IOException if the JSON Object is invalid with respect to ProjectRoleActorsUpdateBean
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (!ProjectRoleActorsUpdateBean.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProjectRoleActorsUpdateBean is not found in the empty JSON string", ProjectRoleActorsUpdateBean.openapiRequiredFields.toString()));
}
}
Set> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry entry : entries) {
if (!ProjectRoleActorsUpdateBean.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProjectRoleActorsUpdateBean` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!ProjectRoleActorsUpdateBean.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProjectRoleActorsUpdateBean' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProjectRoleActorsUpdateBean.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, ProjectRoleActorsUpdateBean value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ProjectRoleActorsUpdateBean read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
return thisAdapter.fromJsonTree(jsonObj);
}
}.nullSafe();
}
}
/**
* Create an instance of ProjectRoleActorsUpdateBean given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProjectRoleActorsUpdateBean
* @throws IOException if the JSON string is invalid with respect to ProjectRoleActorsUpdateBean
*/
public static ProjectRoleActorsUpdateBean fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProjectRoleActorsUpdateBean.class);
}
/**
* Convert an instance of ProjectRoleActorsUpdateBean to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}