software.tnb.jira.validation.generated.model.ProjectRoleActorsUpdateBean Maven / Gradle / Ivy
The newest version!
/*
* 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 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 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 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 software.tnb.jira.validation.generated.JSON;
/**
* ProjectRoleActorsUpdateBean
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-11-09T10:37:50.591249290Z[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 Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to ProjectRoleActorsUpdateBean
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProjectRoleActorsUpdateBean.openapiRequiredFields.isEmpty()) { // has required fields but JSON element 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 = jsonElement.getAsJsonObject().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(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
}
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 {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.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);
}
}