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

com.hubspot.slack.client.models.blocks.elements.EmailInput Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.hubspot.immutables.validation.InvalidImmutableStateException;
import com.hubspot.slack.client.models.blocks.objects.Text;
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 EmailInputIF}.
 * 

* Use the builder to create immutable instances: * {@code EmailInput.builder()}. * Use the static factory method to create immutable instances: * {@code EmailInput.of()}. */ @Generated(from = "EmailInputIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class EmailInput implements EmailInputIF { private transient final String type; private final String actionId; private final @Nullable Text placeholder; private final @Nullable String initialValue; private final @Nullable Boolean focusOnLoad; private EmailInput(String actionId) { this.actionId = Objects.requireNonNull(actionId, "actionId"); this.placeholder = null; this.initialValue = null; this.focusOnLoad = null; this.type = Objects.requireNonNull(EmailInputIF.super.getType(), "type"); } private EmailInput( String actionId, @Nullable Text placeholder, @Nullable String initialValue, @Nullable Boolean focusOnLoad) { this.actionId = actionId; this.placeholder = placeholder; this.initialValue = initialValue; this.focusOnLoad = focusOnLoad; this.type = Objects.requireNonNull(EmailInputIF.super.getType(), "type"); } /** * @return The computed-at-construction value of the {@code type} attribute */ @JsonProperty @Override public String getType() { return type; } /** * @return The value of the {@code actionId} attribute */ @JsonProperty @Override public String getActionId() { return actionId; } /** * @return The value of the {@code placeholder} attribute */ @JsonProperty @Override public Optional getPlaceholder() { return Optional.ofNullable(placeholder); } /** * @return The value of the {@code initialValue} attribute */ @JsonProperty @Override public Optional getInitialValue() { return Optional.ofNullable(initialValue); } /** * @return The value of the {@code focusOnLoad} attribute */ @JsonSetter("focus_on_load") @JsonProperty("is_focus_on_load") @Override public Optional isFocusOnLoad() { return Optional.ofNullable(focusOnLoad); } /** * Copy the current immutable object by setting a value for the {@link EmailInputIF#getActionId() actionId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for actionId * @return A modified copy of the {@code this} object */ public final EmailInput withActionId(String value) { String newValue = Objects.requireNonNull(value, "actionId"); if (this.actionId.equals(newValue)) return this; return validate(new EmailInput(newValue, this.placeholder, this.initialValue, this.focusOnLoad)); } /** * Copy the current immutable object by setting a present value for the optional {@link EmailInputIF#getPlaceholder() placeholder} attribute. * @param value The value for placeholder, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final EmailInput withPlaceholder(@Nullable Text value) { @Nullable Text newValue = value; if (this.placeholder == newValue) return this; return validate(new EmailInput(this.actionId, newValue, this.initialValue, this.focusOnLoad)); } /** * Copy the current immutable object by setting an optional value for the {@link EmailInputIF#getPlaceholder() placeholder} 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 placeholder * @return A modified copy of {@code this} object */ @SuppressWarnings("unchecked") // safe covariant cast public final EmailInput withPlaceholder(Optional optional) { @Nullable Text value = optional.orElse(null); if (this.placeholder == value) return this; return validate(new EmailInput(this.actionId, value, this.initialValue, this.focusOnLoad)); } /** * Copy the current immutable object by setting a present value for the optional {@link EmailInputIF#getInitialValue() initialValue} attribute. * @param value The value for initialValue, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final EmailInput withInitialValue(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.initialValue, newValue)) return this; return validate(new EmailInput(this.actionId, this.placeholder, newValue, this.focusOnLoad)); } /** * Copy the current immutable object by setting an optional value for the {@link EmailInputIF#getInitialValue() initialValue} 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 initialValue * @return A modified copy of {@code this} object */ public final EmailInput withInitialValue(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.initialValue, value)) return this; return validate(new EmailInput(this.actionId, this.placeholder, value, this.focusOnLoad)); } /** * Copy the current immutable object by setting a present value for the optional {@link EmailInputIF#isFocusOnLoad() focusOnLoad} attribute. * @param value The value for focusOnLoad, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final EmailInput withFocusOnLoad(@Nullable Boolean value) { @Nullable Boolean newValue = value; if (Objects.equals(this.focusOnLoad, newValue)) return this; return validate(new EmailInput(this.actionId, this.placeholder, this.initialValue, newValue)); } /** * Copy the current immutable object by setting an optional value for the {@link EmailInputIF#isFocusOnLoad() focusOnLoad} 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 focusOnLoad * @return A modified copy of {@code this} object */ public final EmailInput withFocusOnLoad(Optional optional) { @Nullable Boolean value = optional.orElse(null); if (Objects.equals(this.focusOnLoad, value)) return this; return validate(new EmailInput(this.actionId, this.placeholder, this.initialValue, value)); } /** * This instance is equal to all instances of {@code EmailInput} 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 EmailInput && equalTo(0, (EmailInput) another); } private boolean equalTo(int synthetic, EmailInput another) { return type.equals(another.type) && actionId.equals(another.actionId) && Objects.equals(placeholder, another.placeholder) && Objects.equals(initialValue, another.initialValue) && Objects.equals(focusOnLoad, another.focusOnLoad); } /** * Computes a hash code from attributes: {@code type}, {@code actionId}, {@code placeholder}, {@code initialValue}, {@code focusOnLoad}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + type.hashCode(); h += (h << 5) + actionId.hashCode(); h += (h << 5) + Objects.hashCode(placeholder); h += (h << 5) + Objects.hashCode(initialValue); h += (h << 5) + Objects.hashCode(focusOnLoad); return h; } /** * Prints the immutable value {@code EmailInput} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("EmailInput{"); builder.append("type=").append(type); builder.append(", "); builder.append("actionId=").append(actionId); if (placeholder != null) { builder.append(", "); builder.append("placeholder=").append(placeholder); } if (initialValue != null) { builder.append(", "); builder.append("initialValue=").append(initialValue); } if (focusOnLoad != null) { builder.append(", "); builder.append("focusOnLoad=").append(focusOnLoad); } 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 = "EmailInputIF", generator = "Immutables") @Deprecated @JsonTypeInfo(use=JsonTypeInfo.Id.NONE) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements EmailInputIF { @Nullable String actionId; @Nullable Optional placeholder = Optional.empty(); @Nullable Optional initialValue = Optional.empty(); @Nullable Optional focusOnLoad = Optional.empty(); @JsonProperty public void setActionId(String actionId) { this.actionId = actionId; } @JsonProperty public void setPlaceholder(Optional placeholder) { this.placeholder = placeholder; } @JsonProperty public void setInitialValue(Optional initialValue) { this.initialValue = initialValue; } @JsonSetter("focus_on_load") @JsonProperty("is_focus_on_load") public void setFocusOnLoad(Optional focusOnLoad) { this.focusOnLoad = focusOnLoad; } @JsonIgnore @Override public String getType() { throw new UnsupportedOperationException(); } @Override public String getActionId() { throw new UnsupportedOperationException(); } @Override public Optional getPlaceholder() { throw new UnsupportedOperationException(); } @Override public Optional getInitialValue() { throw new UnsupportedOperationException(); } @Override public Optional isFocusOnLoad() { 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 EmailInput fromJson(Json json) { EmailInput.Builder builder = EmailInput.builder(); if (json.actionId != null) { builder.setActionId(json.actionId); } if (json.placeholder != null) { builder.setPlaceholder(json.placeholder); } if (json.initialValue != null) { builder.setInitialValue(json.initialValue); } if (json.focusOnLoad != null) { builder.setFocusOnLoad(json.focusOnLoad); } return builder.build(); } /** * Construct a new immutable {@code EmailInput} instance. * @param actionId The value for the {@code actionId} attribute * @return An immutable EmailInput instance */ public static EmailInput of(String actionId) { return validate(new EmailInput(actionId)); } private static EmailInput validate(EmailInput instance) { instance = (EmailInput) instance.validate(); return instance; } /** * Creates an immutable copy of a {@link EmailInputIF} 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 EmailInput instance */ public static EmailInput copyOf(EmailInputIF instance) { if (instance instanceof EmailInput) { return (EmailInput) instance; } return EmailInput.builder() .from(instance) .build(); } /** * Creates a builder for {@link EmailInput EmailInput}. *

   * EmailInput.builder()
   *    .setActionId(String) // required {@link EmailInputIF#getActionId() actionId}
   *    .setPlaceholder(com.hubspot.slack.client.models.blocks.objects.Text) // optional {@link EmailInputIF#getPlaceholder() placeholder}
   *    .setInitialValue(String) // optional {@link EmailInputIF#getInitialValue() initialValue}
   *    .setFocusOnLoad(Boolean) // optional {@link EmailInputIF#isFocusOnLoad() focusOnLoad}
   *    .build();
   * 
* @return A new EmailInput builder */ public static EmailInput.Builder builder() { return new EmailInput.Builder(); } /** * Builds instances of type {@link EmailInput EmailInput}. * 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 = "EmailInputIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_ACTION_ID = 0x1L; private long initBits = 0x1L; private @Nullable String actionId; private @Nullable Text placeholder; private @Nullable String initialValue; private @Nullable Boolean focusOnLoad; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.blocks.elements.HasActionId} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(HasActionId 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.blocks.elements.EmailInputIF} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(EmailInputIF 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 HasActionId) { HasActionId instance = (HasActionId) object; if ((bits & 0x1L) == 0) { this.setActionId(instance.getActionId()); bits |= 0x1L; } } if (object instanceof EmailInputIF) { EmailInputIF instance = (EmailInputIF) object; Optional focusOnLoadOptional = instance.isFocusOnLoad(); if (focusOnLoadOptional.isPresent()) { setFocusOnLoad(focusOnLoadOptional); } if ((bits & 0x1L) == 0) { this.setActionId(instance.getActionId()); bits |= 0x1L; } Optional placeholderOptional = instance.getPlaceholder(); if (placeholderOptional.isPresent()) { setPlaceholder(placeholderOptional); } Optional initialValueOptional = instance.getInitialValue(); if (initialValueOptional.isPresent()) { setInitialValue(initialValueOptional); } } } /** * Initializes the value for the {@link EmailInputIF#getActionId() actionId} attribute. * @param actionId The value for actionId * @return {@code this} builder for use in a chained invocation */ public final Builder setActionId(String actionId) { this.actionId = Objects.requireNonNull(actionId, "actionId"); initBits &= ~INIT_BIT_ACTION_ID; return this; } /** * Initializes the optional value {@link EmailInputIF#getPlaceholder() placeholder} to placeholder. * @param placeholder The value for placeholder, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setPlaceholder(@Nullable Text placeholder) { this.placeholder = placeholder; return this; } /** * Initializes the optional value {@link EmailInputIF#getPlaceholder() placeholder} to placeholder. * @param placeholder The value for placeholder * @return {@code this} builder for use in a chained invocation */ public final Builder setPlaceholder(Optional placeholder) { this.placeholder = placeholder.orElse(null); return this; } /** * Initializes the optional value {@link EmailInputIF#getInitialValue() initialValue} to initialValue. * @param initialValue The value for initialValue, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setInitialValue(@Nullable String initialValue) { this.initialValue = initialValue; return this; } /** * Initializes the optional value {@link EmailInputIF#getInitialValue() initialValue} to initialValue. * @param initialValue The value for initialValue * @return {@code this} builder for use in a chained invocation */ public final Builder setInitialValue(Optional initialValue) { this.initialValue = initialValue.orElse(null); return this; } /** * Initializes the optional value {@link EmailInputIF#isFocusOnLoad() focusOnLoad} to focusOnLoad. * @param focusOnLoad The value for focusOnLoad, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setFocusOnLoad(@Nullable Boolean focusOnLoad) { this.focusOnLoad = focusOnLoad; return this; } /** * Initializes the optional value {@link EmailInputIF#isFocusOnLoad() focusOnLoad} to focusOnLoad. * @param focusOnLoad The value for focusOnLoad * @return {@code this} builder for use in a chained invocation */ public final Builder setFocusOnLoad(Optional focusOnLoad) { this.focusOnLoad = focusOnLoad.orElse(null); return this; } /** * Builds a new {@link EmailInput EmailInput}. * @return An immutable instance of EmailInput * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public EmailInput build() { checkRequiredAttributes(); return EmailInput.validate(new EmailInput(actionId, placeholder, initialValue, focusOnLoad)); } private boolean actionIdIsSet() { return (initBits & INIT_BIT_ACTION_ID) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!actionIdIsSet()) attributes.add("actionId"); return "Cannot build EmailInput, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy