All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.slack.client.models.calls.ExternalCallsUser Maven / Gradle / Ivy

package com.hubspot.slack.client.models.calls;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.hubspot.immutables.validation.InvalidImmutableStateException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link ExternalCallsUserIF}.
 * 

* Use the builder to create immutable instances: * {@code ExternalCallsUser.builder()}. */ @Generated(from = "ExternalCallsUserIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ExternalCallsUser implements ExternalCallsUserIF { private final String externalId; private final String displayName; private final String avatarUrl; private ExternalCallsUser(String externalId, String displayName, String avatarUrl) { this.externalId = externalId; this.displayName = displayName; this.avatarUrl = avatarUrl; } /** * @return The value of the {@code externalId} attribute */ @JsonProperty @Override public String getExternalId() { return externalId; } /** * @return The value of the {@code displayName} attribute */ @JsonProperty @Override public String getDisplayName() { return displayName; } /** * @return The value of the {@code avatarUrl} attribute */ @JsonProperty @Override public String getAvatarUrl() { return avatarUrl; } /** * Copy the current immutable object by setting a value for the {@link ExternalCallsUserIF#getExternalId() externalId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for externalId * @return A modified copy of the {@code this} object */ public final ExternalCallsUser withExternalId(String value) { String newValue = Objects.requireNonNull(value, "externalId"); if (this.externalId.equals(newValue)) return this; return new ExternalCallsUser(newValue, this.displayName, this.avatarUrl); } /** * Copy the current immutable object by setting a value for the {@link ExternalCallsUserIF#getDisplayName() displayName} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for displayName * @return A modified copy of the {@code this} object */ public final ExternalCallsUser withDisplayName(String value) { String newValue = Objects.requireNonNull(value, "displayName"); if (this.displayName.equals(newValue)) return this; return new ExternalCallsUser(this.externalId, newValue, this.avatarUrl); } /** * Copy the current immutable object by setting a value for the {@link ExternalCallsUserIF#getAvatarUrl() avatarUrl} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for avatarUrl * @return A modified copy of the {@code this} object */ public final ExternalCallsUser withAvatarUrl(String value) { String newValue = Objects.requireNonNull(value, "avatarUrl"); if (this.avatarUrl.equals(newValue)) return this; return new ExternalCallsUser(this.externalId, this.displayName, newValue); } /** * This instance is equal to all instances of {@code ExternalCallsUser} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ExternalCallsUser && equalTo(0, (ExternalCallsUser) another); } private boolean equalTo(int synthetic, ExternalCallsUser another) { return externalId.equals(another.externalId) && displayName.equals(another.displayName) && avatarUrl.equals(another.avatarUrl); } /** * Computes a hash code from attributes: {@code externalId}, {@code displayName}, {@code avatarUrl}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + externalId.hashCode(); h += (h << 5) + displayName.hashCode(); h += (h << 5) + avatarUrl.hashCode(); return h; } /** * Prints the immutable value {@code ExternalCallsUser} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "ExternalCallsUser{" + "externalId=" + externalId + ", displayName=" + displayName + ", avatarUrl=" + avatarUrl + "}"; } /** * Utility type used to correctly read immutable object from JSON representation. * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure */ @Generated(from = "ExternalCallsUserIF", generator = "Immutables") @Deprecated @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements ExternalCallsUserIF { @Nullable String externalId; @Nullable String displayName; @Nullable String avatarUrl; @JsonProperty public void setExternalId(String externalId) { this.externalId = externalId; } @JsonProperty public void setDisplayName(String displayName) { this.displayName = displayName; } @JsonProperty public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; } @Override public String getExternalId() { throw new UnsupportedOperationException(); } @Override public String getDisplayName() { throw new UnsupportedOperationException(); } @Override public String getAvatarUrl() { throw new UnsupportedOperationException(); } } /** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static ExternalCallsUser fromJson(Json json) { ExternalCallsUser.Builder builder = ExternalCallsUser.builder(); if (json.externalId != null) { builder.setExternalId(json.externalId); } if (json.displayName != null) { builder.setDisplayName(json.displayName); } if (json.avatarUrl != null) { builder.setAvatarUrl(json.avatarUrl); } return builder.build(); } /** * Creates an immutable copy of a {@link ExternalCallsUserIF} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable ExternalCallsUser instance */ public static ExternalCallsUser copyOf(ExternalCallsUserIF instance) { if (instance instanceof ExternalCallsUser) { return (ExternalCallsUser) instance; } return ExternalCallsUser.builder() .from(instance) .build(); } /** * Creates a builder for {@link ExternalCallsUser ExternalCallsUser}. *

   * ExternalCallsUser.builder()
   *    .setExternalId(String) // required {@link ExternalCallsUserIF#getExternalId() externalId}
   *    .setDisplayName(String) // required {@link ExternalCallsUserIF#getDisplayName() displayName}
   *    .setAvatarUrl(String) // required {@link ExternalCallsUserIF#getAvatarUrl() avatarUrl}
   *    .build();
   * 
* @return A new ExternalCallsUser builder */ public static ExternalCallsUser.Builder builder() { return new ExternalCallsUser.Builder(); } /** * Builds instances of type {@link ExternalCallsUser ExternalCallsUser}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "ExternalCallsUserIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_EXTERNAL_ID = 0x1L; private static final long INIT_BIT_DISPLAY_NAME = 0x2L; private static final long INIT_BIT_AVATAR_URL = 0x4L; private long initBits = 0x7L; private @Nullable String externalId; private @Nullable String displayName; private @Nullable String avatarUrl; private Builder() { } /** * Fill a builder with attribute values from the provided {@code ExternalCallsUserIF} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(ExternalCallsUserIF instance) { Objects.requireNonNull(instance, "instance"); this.setExternalId(instance.getExternalId()); this.setDisplayName(instance.getDisplayName()); this.setAvatarUrl(instance.getAvatarUrl()); return this; } /** * Initializes the value for the {@link ExternalCallsUserIF#getExternalId() externalId} attribute. * @param externalId The value for externalId * @return {@code this} builder for use in a chained invocation */ public final Builder setExternalId(String externalId) { this.externalId = Objects.requireNonNull(externalId, "externalId"); initBits &= ~INIT_BIT_EXTERNAL_ID; return this; } /** * Initializes the value for the {@link ExternalCallsUserIF#getDisplayName() displayName} attribute. * @param displayName The value for displayName * @return {@code this} builder for use in a chained invocation */ public final Builder setDisplayName(String displayName) { this.displayName = Objects.requireNonNull(displayName, "displayName"); initBits &= ~INIT_BIT_DISPLAY_NAME; return this; } /** * Initializes the value for the {@link ExternalCallsUserIF#getAvatarUrl() avatarUrl} attribute. * @param avatarUrl The value for avatarUrl * @return {@code this} builder for use in a chained invocation */ public final Builder setAvatarUrl(String avatarUrl) { this.avatarUrl = Objects.requireNonNull(avatarUrl, "avatarUrl"); initBits &= ~INIT_BIT_AVATAR_URL; return this; } /** * Builds a new {@link ExternalCallsUser ExternalCallsUser}. * @return An immutable instance of ExternalCallsUser * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public ExternalCallsUser build() { checkRequiredAttributes(); return new ExternalCallsUser(externalId, displayName, avatarUrl); } private boolean externalIdIsSet() { return (initBits & INIT_BIT_EXTERNAL_ID) == 0; } private boolean displayNameIsSet() { return (initBits & INIT_BIT_DISPLAY_NAME) == 0; } private boolean avatarUrlIsSet() { return (initBits & INIT_BIT_AVATAR_URL) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!externalIdIsSet()) attributes.add("externalId"); if (!displayNameIsSet()) attributes.add("displayName"); if (!avatarUrlIsSet()) attributes.add("avatarUrl"); return "Cannot build ExternalCallsUser, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy