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

com.hubspot.slack.client.models.blocks.Divider Maven / Gradle / Ivy

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

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.JsonTypeInfo;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
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 DividerIF}.
 * 

* Use the builder to create immutable instances: * {@code Divider.builder()}. */ @Generated(from = "DividerIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class Divider implements DividerIF { private final @Nullable String blockId; private transient final String type; private Divider(@Nullable String blockId) { this.blockId = blockId; this.type = Objects.requireNonNull(DividerIF.super.getType(), "type"); } /** * @return The value of the {@code blockId} attribute */ @JsonProperty @Override public Optional getBlockId() { return Optional.ofNullable(blockId); } /** * @return The computed-at-construction value of the {@code type} attribute */ @JsonProperty @Override public String getType() { return type; } /** * Copy the current immutable object by setting a present value for the optional {@link DividerIF#getBlockId() blockId} attribute. * @param value The value for blockId, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final Divider withBlockId(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.blockId, newValue)) return this; return new Divider(newValue); } /** * Copy the current immutable object by setting an optional value for the {@link DividerIF#getBlockId() blockId} 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 blockId * @return A modified copy of {@code this} object */ public final Divider withBlockId(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.blockId, value)) return this; return new Divider(value); } /** * This instance is equal to all instances of {@code Divider} 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 Divider && equalTo(0, (Divider) another); } private boolean equalTo(int synthetic, Divider another) { return Objects.equals(blockId, another.blockId) && type.equals(another.type); } /** * Computes a hash code from attributes: {@code blockId}, {@code type}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(blockId); h += (h << 5) + type.hashCode(); return h; } /** * Prints the immutable value {@code Divider} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("Divider{"); if (blockId != null) { builder.append("blockId=").append(blockId); } if (builder.length() > 8) builder.append(", "); builder.append("type=").append(type); 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 = "DividerIF", generator = "Immutables") @Deprecated @JsonTypeInfo(use=JsonTypeInfo.Id.NONE) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements DividerIF { @Nullable Optional blockId = Optional.empty(); @JsonProperty public void setBlockId(Optional blockId) { this.blockId = blockId; } @Override public Optional getBlockId() { throw new UnsupportedOperationException(); } @JsonIgnore @Override public String getType() { 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 Divider fromJson(Json json) { Divider.Builder builder = Divider.builder(); if (json.blockId != null) { builder.setBlockId(json.blockId); } return builder.build(); } /** * Creates an immutable copy of a {@link DividerIF} 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 Divider instance */ public static Divider copyOf(DividerIF instance) { if (instance instanceof Divider) { return (Divider) instance; } return Divider.builder() .from(instance) .build(); } /** * Creates a builder for {@link Divider Divider}. *

   * Divider.builder()
   *    .setBlockId(String) // optional {@link DividerIF#getBlockId() blockId}
   *    .build();
   * 
* @return A new Divider builder */ public static Divider.Builder builder() { return new Divider.Builder(); } /** * Builds instances of type {@link Divider Divider}. * 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 = "DividerIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private @Nullable String blockId; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.blocks.Block} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(Block 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.DividerIF} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(DividerIF 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 Block) { Block instance = (Block) object; if ((bits & 0x1L) == 0) { Optional blockIdOptional = instance.getBlockId(); if (blockIdOptional.isPresent()) { setBlockId(blockIdOptional); } bits |= 0x1L; } } if (object instanceof DividerIF) { DividerIF instance = (DividerIF) object; if ((bits & 0x1L) == 0) { Optional blockIdOptional = instance.getBlockId(); if (blockIdOptional.isPresent()) { setBlockId(blockIdOptional); } bits |= 0x1L; } } } /** * Initializes the optional value {@link DividerIF#getBlockId() blockId} to blockId. * @param blockId The value for blockId, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setBlockId(@Nullable String blockId) { this.blockId = blockId; return this; } /** * Initializes the optional value {@link DividerIF#getBlockId() blockId} to blockId. * @param blockId The value for blockId * @return {@code this} builder for use in a chained invocation */ public final Builder setBlockId(Optional blockId) { this.blockId = blockId.orElse(null); return this; } /** * Builds a new {@link Divider Divider}. * @return An immutable instance of Divider * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public Divider build() { return new Divider(blockId); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy