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

com.hubspot.slack.client.models.response.chat.ChatUpdateMessageResponse Maven / Gradle / Ivy

There is a newer version: 1.16.7
Show newest version
package com.hubspot.slack.client.models.response.chat;

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 com.hubspot.slack.client.models.response.*;
import com.hubspot.slack.client.models.response.SlackResponse;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
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 ChatUpdateMessageResponseIF}.
 * 

* Use the builder to create immutable instances: * {@code ChatUpdateMessageResponse.builder()}. */ @Generated(from = "ChatUpdateMessageResponseIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ChatUpdateMessageResponse implements ChatUpdateMessageResponseIF { private final boolean ok; private final @Nullable ResponseMetadata responseMetadata; private final String ts; private final String channel; private final String text; private ChatUpdateMessageResponse( boolean ok, @Nullable ResponseMetadata responseMetadata, String ts, String channel, String text) { this.ok = ok; this.responseMetadata = responseMetadata; this.ts = ts; this.channel = channel; this.text = text; } /** * @return The value of the {@code ok} attribute */ @JsonProperty @Override public boolean isOk() { return ok; } /** * @return The value of the {@code responseMetadata} attribute */ @JsonProperty("response_metadata") @Override public Optional getResponseMetadata() { return Optional.ofNullable(responseMetadata); } /** * @return The value of the {@code ts} attribute */ @JsonProperty @Override public String getTs() { return ts; } /** * @return The value of the {@code channel} attribute */ @JsonProperty @Override public String getChannel() { return channel; } /** * @return The value of the {@code text} attribute */ @JsonProperty @Override public String getText() { return text; } /** * Copy the current immutable object by setting a value for the {@link ChatUpdateMessageResponseIF#isOk() ok} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for ok * @return A modified copy of the {@code this} object */ public final ChatUpdateMessageResponse withOk(boolean value) { if (this.ok == value) return this; return new ChatUpdateMessageResponse(value, this.responseMetadata, this.ts, this.channel, this.text); } /** * Copy the current immutable object by setting a present value for the optional {@link ChatUpdateMessageResponseIF#getResponseMetadata() responseMetadata} attribute. * @param value The value for responseMetadata, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final ChatUpdateMessageResponse withResponseMetadata(@Nullable ResponseMetadata value) { @Nullable ResponseMetadata newValue = value; if (this.responseMetadata == newValue) return this; return new ChatUpdateMessageResponse(this.ok, newValue, this.ts, this.channel, this.text); } /** * Copy the current immutable object by setting an optional value for the {@link ChatUpdateMessageResponseIF#getResponseMetadata() responseMetadata} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for responseMetadata * @return A modified copy of {@code this} object */ @SuppressWarnings("unchecked") // safe covariant cast public final ChatUpdateMessageResponse withResponseMetadata(Optional optional) { @Nullable ResponseMetadata value = optional.orElse(null); if (this.responseMetadata == value) return this; return new ChatUpdateMessageResponse(this.ok, value, this.ts, this.channel, this.text); } /** * Copy the current immutable object by setting a value for the {@link ChatUpdateMessageResponseIF#getTs() ts} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for ts * @return A modified copy of the {@code this} object */ public final ChatUpdateMessageResponse withTs(String value) { String newValue = Objects.requireNonNull(value, "ts"); if (this.ts.equals(newValue)) return this; return new ChatUpdateMessageResponse(this.ok, this.responseMetadata, newValue, this.channel, this.text); } /** * Copy the current immutable object by setting a value for the {@link ChatUpdateMessageResponseIF#getChannel() channel} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for channel * @return A modified copy of the {@code this} object */ public final ChatUpdateMessageResponse withChannel(String value) { String newValue = Objects.requireNonNull(value, "channel"); if (this.channel.equals(newValue)) return this; return new ChatUpdateMessageResponse(this.ok, this.responseMetadata, this.ts, newValue, this.text); } /** * Copy the current immutable object by setting a value for the {@link ChatUpdateMessageResponseIF#getText() text} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for text * @return A modified copy of the {@code this} object */ public final ChatUpdateMessageResponse withText(String value) { String newValue = Objects.requireNonNull(value, "text"); if (this.text.equals(newValue)) return this; return new ChatUpdateMessageResponse(this.ok, this.responseMetadata, this.ts, this.channel, newValue); } /** * This instance is equal to all instances of {@code ChatUpdateMessageResponse} 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 ChatUpdateMessageResponse && equalTo(0, (ChatUpdateMessageResponse) another); } private boolean equalTo(int synthetic, ChatUpdateMessageResponse another) { return ok == another.ok && Objects.equals(responseMetadata, another.responseMetadata) && ts.equals(another.ts) && channel.equals(another.channel) && text.equals(another.text); } /** * Computes a hash code from attributes: {@code ok}, {@code responseMetadata}, {@code ts}, {@code channel}, {@code text}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Boolean.hashCode(ok); h += (h << 5) + Objects.hashCode(responseMetadata); h += (h << 5) + ts.hashCode(); h += (h << 5) + channel.hashCode(); h += (h << 5) + text.hashCode(); return h; } /** * Prints the immutable value {@code ChatUpdateMessageResponse} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("ChatUpdateMessageResponse{"); builder.append("ok=").append(ok); if (responseMetadata != null) { builder.append(", "); builder.append("responseMetadata=").append(responseMetadata); } builder.append(", "); builder.append("ts=").append(ts); builder.append(", "); builder.append("channel=").append(channel); builder.append(", "); builder.append("text=").append(text); return builder.append("}").toString(); } /** * 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 = "ChatUpdateMessageResponseIF", generator = "Immutables") @Deprecated @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements ChatUpdateMessageResponseIF { boolean ok; boolean okIsSet; @Nullable Optional responseMetadata = Optional.empty(); @Nullable String ts; @Nullable String channel; @Nullable String text; @JsonProperty public void setOk(boolean ok) { this.ok = ok; this.okIsSet = true; } @JsonProperty("response_metadata") public void setResponseMetadata(Optional responseMetadata) { this.responseMetadata = responseMetadata; } @JsonProperty public void setTs(String ts) { this.ts = ts; } @JsonProperty public void setChannel(String channel) { this.channel = channel; } @JsonProperty public void setText(String text) { this.text = text; } @Override public boolean isOk() { throw new UnsupportedOperationException(); } @Override public Optional getResponseMetadata() { throw new UnsupportedOperationException(); } @Override public String getTs() { throw new UnsupportedOperationException(); } @Override public String getChannel() { throw new UnsupportedOperationException(); } @Override public String getText() { 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 ChatUpdateMessageResponse fromJson(Json json) { ChatUpdateMessageResponse.Builder builder = ChatUpdateMessageResponse.builder(); if (json.okIsSet) { builder.setOk(json.ok); } if (json.responseMetadata != null) { builder.setResponseMetadata(json.responseMetadata); } if (json.ts != null) { builder.setTs(json.ts); } if (json.channel != null) { builder.setChannel(json.channel); } if (json.text != null) { builder.setText(json.text); } return builder.build(); } /** * Creates an immutable copy of a {@link ChatUpdateMessageResponseIF} 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 ChatUpdateMessageResponse instance */ public static ChatUpdateMessageResponse copyOf(ChatUpdateMessageResponseIF instance) { if (instance instanceof ChatUpdateMessageResponse) { return (ChatUpdateMessageResponse) instance; } return ChatUpdateMessageResponse.builder() .from(instance) .build(); } /** * Creates a builder for {@link ChatUpdateMessageResponse ChatUpdateMessageResponse}. *

   * ChatUpdateMessageResponse.builder()
   *    .setOk(boolean) // required {@link ChatUpdateMessageResponseIF#isOk() ok}
   *    .setResponseMetadata(ResponseMetadata) // optional {@link ChatUpdateMessageResponseIF#getResponseMetadata() responseMetadata}
   *    .setTs(String) // required {@link ChatUpdateMessageResponseIF#getTs() ts}
   *    .setChannel(String) // required {@link ChatUpdateMessageResponseIF#getChannel() channel}
   *    .setText(String) // required {@link ChatUpdateMessageResponseIF#getText() text}
   *    .build();
   * 
* @return A new ChatUpdateMessageResponse builder */ public static ChatUpdateMessageResponse.Builder builder() { return new ChatUpdateMessageResponse.Builder(); } /** * Builds instances of type {@link ChatUpdateMessageResponse ChatUpdateMessageResponse}. * 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 = "ChatUpdateMessageResponseIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_OK = 0x1L; private static final long INIT_BIT_TS = 0x2L; private static final long INIT_BIT_CHANNEL = 0x4L; private static final long INIT_BIT_TEXT = 0x8L; private long initBits = 0xfL; private boolean ok; private @Nullable ResponseMetadata responseMetadata; private @Nullable String ts; private @Nullable String channel; private @Nullable String text; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.response.SlackResponse} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SlackResponse instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.response.chat.ChatUpdateMessageResponseIF} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(ChatUpdateMessageResponseIF instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } private void from(short _unused, Object object) { long bits = 0; if (object instanceof SlackResponse) { SlackResponse instance = (SlackResponse) object; if ((bits & 0x2L) == 0) { this.setOk(instance.isOk()); bits |= 0x2L; } if ((bits & 0x1L) == 0) { Optional responseMetadataOptional = instance.getResponseMetadata(); if (responseMetadataOptional.isPresent()) { setResponseMetadata(responseMetadataOptional); } bits |= 0x1L; } } if (object instanceof ChatUpdateMessageResponseIF) { ChatUpdateMessageResponseIF instance = (ChatUpdateMessageResponseIF) object; this.setChannel(instance.getChannel()); if ((bits & 0x1L) == 0) { Optional responseMetadataOptional = instance.getResponseMetadata(); if (responseMetadataOptional.isPresent()) { setResponseMetadata(responseMetadataOptional); } bits |= 0x1L; } this.setText(instance.getText()); if ((bits & 0x2L) == 0) { this.setOk(instance.isOk()); bits |= 0x2L; } this.setTs(instance.getTs()); } } /** * Initializes the value for the {@link ChatUpdateMessageResponseIF#isOk() ok} attribute. * @param ok The value for ok * @return {@code this} builder for use in a chained invocation */ public final Builder setOk(boolean ok) { this.ok = ok; initBits &= ~INIT_BIT_OK; return this; } /** * Initializes the optional value {@link ChatUpdateMessageResponseIF#getResponseMetadata() responseMetadata} to responseMetadata. * @param responseMetadata The value for responseMetadata, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setResponseMetadata(@Nullable ResponseMetadata responseMetadata) { this.responseMetadata = responseMetadata; return this; } /** * Initializes the optional value {@link ChatUpdateMessageResponseIF#getResponseMetadata() responseMetadata} to responseMetadata. * @param responseMetadata The value for responseMetadata * @return {@code this} builder for use in a chained invocation */ public final Builder setResponseMetadata(Optional responseMetadata) { this.responseMetadata = responseMetadata.orElse(null); return this; } /** * Initializes the value for the {@link ChatUpdateMessageResponseIF#getTs() ts} attribute. * @param ts The value for ts * @return {@code this} builder for use in a chained invocation */ public final Builder setTs(String ts) { this.ts = Objects.requireNonNull(ts, "ts"); initBits &= ~INIT_BIT_TS; return this; } /** * Initializes the value for the {@link ChatUpdateMessageResponseIF#getChannel() channel} attribute. * @param channel The value for channel * @return {@code this} builder for use in a chained invocation */ public final Builder setChannel(String channel) { this.channel = Objects.requireNonNull(channel, "channel"); initBits &= ~INIT_BIT_CHANNEL; return this; } /** * Initializes the value for the {@link ChatUpdateMessageResponseIF#getText() text} attribute. * @param text The value for text * @return {@code this} builder for use in a chained invocation */ public final Builder setText(String text) { this.text = Objects.requireNonNull(text, "text"); initBits &= ~INIT_BIT_TEXT; return this; } /** * Builds a new {@link ChatUpdateMessageResponse ChatUpdateMessageResponse}. * @return An immutable instance of ChatUpdateMessageResponse * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public ChatUpdateMessageResponse build() { checkRequiredAttributes(); return new ChatUpdateMessageResponse(ok, responseMetadata, ts, channel, text); } private boolean okIsSet() { return (initBits & INIT_BIT_OK) == 0; } private boolean tsIsSet() { return (initBits & INIT_BIT_TS) == 0; } private boolean channelIsSet() { return (initBits & INIT_BIT_CHANNEL) == 0; } private boolean textIsSet() { return (initBits & INIT_BIT_TEXT) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!okIsSet()) attributes.add("ok"); if (!tsIsSet()) attributes.add("ts"); if (!channelIsSet()) attributes.add("channel"); if (!textIsSet()) attributes.add("text"); return "Cannot build ChatUpdateMessageResponse, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy