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

com.hubspot.slack.client.methods.params.conversations.ConversationsInfoParams Maven / Gradle / Ivy

package com.hubspot.slack.client.methods.params.conversations;

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 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 ConversationsInfoParamsIF}.
 * 

* Use the builder to create immutable instances: * {@code ConversationsInfoParams.builder()}. */ @Generated(from = "ConversationsInfoParamsIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ConversationsInfoParams implements ConversationsInfoParamsIF { private final String conversationId; private final @Nullable Boolean includeLocale; private final @Nullable Boolean includeNumMembers; private ConversationsInfoParams( String conversationId, @Nullable Boolean includeLocale, @Nullable Boolean includeNumMembers) { this.conversationId = conversationId; this.includeLocale = includeLocale; this.includeNumMembers = includeNumMembers; } /** * @return The value of the {@code conversationId} attribute */ @JsonProperty("channel") @Override public String getConversationId() { return conversationId; } /** * @return The value of the {@code includeLocale} attribute */ @JsonProperty @Override public Optional getIncludeLocale() { return Optional.ofNullable(includeLocale); } /** * @return The value of the {@code includeNumMembers} attribute */ @JsonProperty @Override public Optional getIncludeNumMembers() { return Optional.ofNullable(includeNumMembers); } /** * Copy the current immutable object by setting a value for the {@link ConversationsInfoParamsIF#getConversationId() conversationId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for conversationId * @return A modified copy of the {@code this} object */ public final ConversationsInfoParams withConversationId(String value) { String newValue = Objects.requireNonNull(value, "conversationId"); if (this.conversationId.equals(newValue)) return this; return new ConversationsInfoParams(newValue, this.includeLocale, this.includeNumMembers); } /** * Copy the current immutable object by setting a present value for the optional {@link ConversationsInfoParamsIF#getIncludeLocale() includeLocale} attribute. * @param value The value for includeLocale, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final ConversationsInfoParams withIncludeLocale(@Nullable Boolean value) { @Nullable Boolean newValue = value; if (Objects.equals(this.includeLocale, newValue)) return this; return new ConversationsInfoParams(this.conversationId, newValue, this.includeNumMembers); } /** * Copy the current immutable object by setting an optional value for the {@link ConversationsInfoParamsIF#getIncludeLocale() includeLocale} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for includeLocale * @return A modified copy of {@code this} object */ public final ConversationsInfoParams withIncludeLocale(Optional optional) { @Nullable Boolean value = optional.orElse(null); if (Objects.equals(this.includeLocale, value)) return this; return new ConversationsInfoParams(this.conversationId, value, this.includeNumMembers); } /** * Copy the current immutable object by setting a present value for the optional {@link ConversationsInfoParamsIF#getIncludeNumMembers() includeNumMembers} attribute. * @param value The value for includeNumMembers, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final ConversationsInfoParams withIncludeNumMembers(@Nullable Boolean value) { @Nullable Boolean newValue = value; if (Objects.equals(this.includeNumMembers, newValue)) return this; return new ConversationsInfoParams(this.conversationId, this.includeLocale, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link ConversationsInfoParamsIF#getIncludeNumMembers() includeNumMembers} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for includeNumMembers * @return A modified copy of {@code this} object */ public final ConversationsInfoParams withIncludeNumMembers(Optional optional) { @Nullable Boolean value = optional.orElse(null); if (Objects.equals(this.includeNumMembers, value)) return this; return new ConversationsInfoParams(this.conversationId, this.includeLocale, value); } /** * This instance is equal to all instances of {@code ConversationsInfoParams} 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 ConversationsInfoParams && equalTo(0, (ConversationsInfoParams) another); } private boolean equalTo(int synthetic, ConversationsInfoParams another) { return conversationId.equals(another.conversationId) && Objects.equals(includeLocale, another.includeLocale) && Objects.equals(includeNumMembers, another.includeNumMembers); } /** * Computes a hash code from attributes: {@code conversationId}, {@code includeLocale}, {@code includeNumMembers}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + conversationId.hashCode(); h += (h << 5) + Objects.hashCode(includeLocale); h += (h << 5) + Objects.hashCode(includeNumMembers); return h; } /** * Prints the immutable value {@code ConversationsInfoParams} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("ConversationsInfoParams{"); builder.append("conversationId=").append(conversationId); if (includeLocale != null) { builder.append(", "); builder.append("includeLocale=").append(includeLocale); } if (includeNumMembers != null) { builder.append(", "); builder.append("includeNumMembers=").append(includeNumMembers); } 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 = "ConversationsInfoParamsIF", generator = "Immutables") @Deprecated @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements ConversationsInfoParamsIF { @Nullable String conversationId; @Nullable Optional includeLocale = Optional.empty(); @Nullable Optional includeNumMembers = Optional.empty(); @JsonProperty("channel") public void setConversationId(String conversationId) { this.conversationId = conversationId; } @JsonProperty public void setIncludeLocale(Optional includeLocale) { this.includeLocale = includeLocale; } @JsonProperty public void setIncludeNumMembers(Optional includeNumMembers) { this.includeNumMembers = includeNumMembers; } @Override public String getConversationId() { throw new UnsupportedOperationException(); } @Override public Optional getIncludeLocale() { throw new UnsupportedOperationException(); } @Override public Optional getIncludeNumMembers() { 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 ConversationsInfoParams fromJson(Json json) { ConversationsInfoParams.Builder builder = ConversationsInfoParams.builder(); if (json.conversationId != null) { builder.setConversationId(json.conversationId); } if (json.includeLocale != null) { builder.setIncludeLocale(json.includeLocale); } if (json.includeNumMembers != null) { builder.setIncludeNumMembers(json.includeNumMembers); } return builder.build(); } /** * Creates an immutable copy of a {@link ConversationsInfoParamsIF} 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 ConversationsInfoParams instance */ public static ConversationsInfoParams copyOf(ConversationsInfoParamsIF instance) { if (instance instanceof ConversationsInfoParams) { return (ConversationsInfoParams) instance; } return ConversationsInfoParams.builder() .from(instance) .build(); } /** * Creates a builder for {@link ConversationsInfoParams ConversationsInfoParams}. *

   * ConversationsInfoParams.builder()
   *    .setConversationId(String) // required {@link ConversationsInfoParamsIF#getConversationId() conversationId}
   *    .setIncludeLocale(Boolean) // optional {@link ConversationsInfoParamsIF#getIncludeLocale() includeLocale}
   *    .setIncludeNumMembers(Boolean) // optional {@link ConversationsInfoParamsIF#getIncludeNumMembers() includeNumMembers}
   *    .build();
   * 
* @return A new ConversationsInfoParams builder */ public static ConversationsInfoParams.Builder builder() { return new ConversationsInfoParams.Builder(); } /** * Builds instances of type {@link ConversationsInfoParams ConversationsInfoParams}. * 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 = "ConversationsInfoParamsIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_CONVERSATION_ID = 0x1L; private long initBits = 0x1L; private @Nullable String conversationId; private @Nullable Boolean includeLocale; private @Nullable Boolean includeNumMembers; private Builder() { } /** * Fill a builder with attribute values from the provided {@code ConversationsInfoParamsIF} 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(ConversationsInfoParamsIF instance) { Objects.requireNonNull(instance, "instance"); this.setConversationId(instance.getConversationId()); Optional includeLocaleOptional = instance.getIncludeLocale(); if (includeLocaleOptional.isPresent()) { setIncludeLocale(includeLocaleOptional); } Optional includeNumMembersOptional = instance.getIncludeNumMembers(); if (includeNumMembersOptional.isPresent()) { setIncludeNumMembers(includeNumMembersOptional); } return this; } /** * Initializes the value for the {@link ConversationsInfoParamsIF#getConversationId() conversationId} attribute. * @param conversationId The value for conversationId * @return {@code this} builder for use in a chained invocation */ public final Builder setConversationId(String conversationId) { this.conversationId = Objects.requireNonNull(conversationId, "conversationId"); initBits &= ~INIT_BIT_CONVERSATION_ID; return this; } /** * Initializes the optional value {@link ConversationsInfoParamsIF#getIncludeLocale() includeLocale} to includeLocale. * @param includeLocale The value for includeLocale, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setIncludeLocale(@Nullable Boolean includeLocale) { this.includeLocale = includeLocale; return this; } /** * Initializes the optional value {@link ConversationsInfoParamsIF#getIncludeLocale() includeLocale} to includeLocale. * @param includeLocale The value for includeLocale * @return {@code this} builder for use in a chained invocation */ public final Builder setIncludeLocale(Optional includeLocale) { this.includeLocale = includeLocale.orElse(null); return this; } /** * Initializes the optional value {@link ConversationsInfoParamsIF#getIncludeNumMembers() includeNumMembers} to includeNumMembers. * @param includeNumMembers The value for includeNumMembers, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setIncludeNumMembers(@Nullable Boolean includeNumMembers) { this.includeNumMembers = includeNumMembers; return this; } /** * Initializes the optional value {@link ConversationsInfoParamsIF#getIncludeNumMembers() includeNumMembers} to includeNumMembers. * @param includeNumMembers The value for includeNumMembers * @return {@code this} builder for use in a chained invocation */ public final Builder setIncludeNumMembers(Optional includeNumMembers) { this.includeNumMembers = includeNumMembers.orElse(null); return this; } /** * Builds a new {@link ConversationsInfoParams ConversationsInfoParams}. * @return An immutable instance of ConversationsInfoParams * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public ConversationsInfoParams build() { checkRequiredAttributes(); return new ConversationsInfoParams(conversationId, includeLocale, includeNumMembers); } private boolean conversationIdIsSet() { return (initBits & INIT_BIT_CONVERSATION_ID) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!conversationIdIsSet()) attributes.add("conversationId"); return "Cannot build ConversationsInfoParams, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy