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

com.hubspot.slack.client.models.ScheduledMessage Maven / Gradle / Ivy

package com.hubspot.slack.client.models;

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

* Use the builder to create immutable instances: * {@code ScheduledMessage.builder()}. */ @Generated(from = "ScheduledMessageIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ScheduledMessage implements ScheduledMessageIF { private final String id; private final String channelId; private final long postAt; private final long dateCreated; private final String text; private ScheduledMessage( String id, String channelId, long postAt, long dateCreated, String text) { this.id = id; this.channelId = channelId; this.postAt = postAt; this.dateCreated = dateCreated; this.text = text; } /** * @return The value of the {@code id} attribute */ @JsonProperty @Override public String getId() { return id; } /** * @return The value of the {@code channelId} attribute */ @JsonProperty @Override public String getChannelId() { return channelId; } /** * @return The value of the {@code postAt} attribute */ @JsonProperty @Override public long getPostAt() { return postAt; } /** * @return The value of the {@code dateCreated} attribute */ @JsonProperty @Override public long getDateCreated() { return dateCreated; } /** * @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 ScheduledMessageIF#getId() id} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for id * @return A modified copy of the {@code this} object */ public final ScheduledMessage withId(String value) { String newValue = Objects.requireNonNull(value, "id"); if (this.id.equals(newValue)) return this; return new ScheduledMessage(newValue, this.channelId, this.postAt, this.dateCreated, this.text); } /** * Copy the current immutable object by setting a value for the {@link ScheduledMessageIF#getChannelId() channelId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for channelId * @return A modified copy of the {@code this} object */ public final ScheduledMessage withChannelId(String value) { String newValue = Objects.requireNonNull(value, "channelId"); if (this.channelId.equals(newValue)) return this; return new ScheduledMessage(this.id, newValue, this.postAt, this.dateCreated, this.text); } /** * Copy the current immutable object by setting a value for the {@link ScheduledMessageIF#getPostAt() postAt} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for postAt * @return A modified copy of the {@code this} object */ public final ScheduledMessage withPostAt(long value) { if (this.postAt == value) return this; return new ScheduledMessage(this.id, this.channelId, value, this.dateCreated, this.text); } /** * Copy the current immutable object by setting a value for the {@link ScheduledMessageIF#getDateCreated() dateCreated} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for dateCreated * @return A modified copy of the {@code this} object */ public final ScheduledMessage withDateCreated(long value) { if (this.dateCreated == value) return this; return new ScheduledMessage(this.id, this.channelId, this.postAt, value, this.text); } /** * Copy the current immutable object by setting a value for the {@link ScheduledMessageIF#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 ScheduledMessage withText(String value) { String newValue = Objects.requireNonNull(value, "text"); if (this.text.equals(newValue)) return this; return new ScheduledMessage(this.id, this.channelId, this.postAt, this.dateCreated, newValue); } /** * This instance is equal to all instances of {@code ScheduledMessage} 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 ScheduledMessage && equalTo(0, (ScheduledMessage) another); } private boolean equalTo(int synthetic, ScheduledMessage another) { return id.equals(another.id) && channelId.equals(another.channelId) && postAt == another.postAt && dateCreated == another.dateCreated && text.equals(another.text); } /** * Computes a hash code from attributes: {@code id}, {@code channelId}, {@code postAt}, {@code dateCreated}, {@code text}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + id.hashCode(); h += (h << 5) + channelId.hashCode(); h += (h << 5) + Long.hashCode(postAt); h += (h << 5) + Long.hashCode(dateCreated); h += (h << 5) + text.hashCode(); return h; } /** * Prints the immutable value {@code ScheduledMessage} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "ScheduledMessage{" + "id=" + id + ", channelId=" + channelId + ", postAt=" + postAt + ", dateCreated=" + dateCreated + ", text=" + text + "}"; } /** * 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 = "ScheduledMessageIF", generator = "Immutables") @Deprecated @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements ScheduledMessageIF { @Nullable String id; @Nullable String channelId; long postAt; boolean postAtIsSet; long dateCreated; boolean dateCreatedIsSet; @Nullable String text; @JsonProperty public void setId(String id) { this.id = id; } @JsonProperty public void setChannelId(String channelId) { this.channelId = channelId; } @JsonProperty public void setPostAt(long postAt) { this.postAt = postAt; this.postAtIsSet = true; } @JsonProperty public void setDateCreated(long dateCreated) { this.dateCreated = dateCreated; this.dateCreatedIsSet = true; } @JsonProperty public void setText(String text) { this.text = text; } @Override public String getId() { throw new UnsupportedOperationException(); } @Override public String getChannelId() { throw new UnsupportedOperationException(); } @Override public long getPostAt() { throw new UnsupportedOperationException(); } @Override public long getDateCreated() { 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 ScheduledMessage fromJson(Json json) { ScheduledMessage.Builder builder = ScheduledMessage.builder(); if (json.id != null) { builder.setId(json.id); } if (json.channelId != null) { builder.setChannelId(json.channelId); } if (json.postAtIsSet) { builder.setPostAt(json.postAt); } if (json.dateCreatedIsSet) { builder.setDateCreated(json.dateCreated); } if (json.text != null) { builder.setText(json.text); } return builder.build(); } /** * Creates an immutable copy of a {@link ScheduledMessageIF} 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 ScheduledMessage instance */ public static ScheduledMessage copyOf(ScheduledMessageIF instance) { if (instance instanceof ScheduledMessage) { return (ScheduledMessage) instance; } return ScheduledMessage.builder() .from(instance) .build(); } /** * Creates a builder for {@link ScheduledMessage ScheduledMessage}. *

   * ScheduledMessage.builder()
   *    .setId(String) // required {@link ScheduledMessageIF#getId() id}
   *    .setChannelId(String) // required {@link ScheduledMessageIF#getChannelId() channelId}
   *    .setPostAt(long) // required {@link ScheduledMessageIF#getPostAt() postAt}
   *    .setDateCreated(long) // required {@link ScheduledMessageIF#getDateCreated() dateCreated}
   *    .setText(String) // required {@link ScheduledMessageIF#getText() text}
   *    .build();
   * 
* @return A new ScheduledMessage builder */ public static ScheduledMessage.Builder builder() { return new ScheduledMessage.Builder(); } /** * Builds instances of type {@link ScheduledMessage ScheduledMessage}. * 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 = "ScheduledMessageIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_ID = 0x1L; private static final long INIT_BIT_CHANNEL_ID = 0x2L; private static final long INIT_BIT_POST_AT = 0x4L; private static final long INIT_BIT_DATE_CREATED = 0x8L; private static final long INIT_BIT_TEXT = 0x10L; private long initBits = 0x1fL; private @Nullable String id; private @Nullable String channelId; private long postAt; private long dateCreated; private @Nullable String text; private Builder() { } /** * Fill a builder with attribute values from the provided {@code ScheduledMessageIF} 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(ScheduledMessageIF instance) { Objects.requireNonNull(instance, "instance"); this.setId(instance.getId()); this.setChannelId(instance.getChannelId()); this.setPostAt(instance.getPostAt()); this.setDateCreated(instance.getDateCreated()); this.setText(instance.getText()); return this; } /** * Initializes the value for the {@link ScheduledMessageIF#getId() id} attribute. * @param id The value for id * @return {@code this} builder for use in a chained invocation */ public final Builder setId(String id) { this.id = Objects.requireNonNull(id, "id"); initBits &= ~INIT_BIT_ID; return this; } /** * Initializes the value for the {@link ScheduledMessageIF#getChannelId() channelId} attribute. * @param channelId The value for channelId * @return {@code this} builder for use in a chained invocation */ public final Builder setChannelId(String channelId) { this.channelId = Objects.requireNonNull(channelId, "channelId"); initBits &= ~INIT_BIT_CHANNEL_ID; return this; } /** * Initializes the value for the {@link ScheduledMessageIF#getPostAt() postAt} attribute. * @param postAt The value for postAt * @return {@code this} builder for use in a chained invocation */ public final Builder setPostAt(long postAt) { this.postAt = postAt; initBits &= ~INIT_BIT_POST_AT; return this; } /** * Initializes the value for the {@link ScheduledMessageIF#getDateCreated() dateCreated} attribute. * @param dateCreated The value for dateCreated * @return {@code this} builder for use in a chained invocation */ public final Builder setDateCreated(long dateCreated) { this.dateCreated = dateCreated; initBits &= ~INIT_BIT_DATE_CREATED; return this; } /** * Initializes the value for the {@link ScheduledMessageIF#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 ScheduledMessage ScheduledMessage}. * @return An immutable instance of ScheduledMessage * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public ScheduledMessage build() { checkRequiredAttributes(); return new ScheduledMessage(id, channelId, postAt, dateCreated, text); } private boolean idIsSet() { return (initBits & INIT_BIT_ID) == 0; } private boolean channelIdIsSet() { return (initBits & INIT_BIT_CHANNEL_ID) == 0; } private boolean postAtIsSet() { return (initBits & INIT_BIT_POST_AT) == 0; } private boolean dateCreatedIsSet() { return (initBits & INIT_BIT_DATE_CREATED) == 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 (!idIsSet()) attributes.add("id"); if (!channelIdIsSet()) attributes.add("channelId"); if (!postAtIsSet()) attributes.add("postAt"); if (!dateCreatedIsSet()) attributes.add("dateCreated"); if (!textIsSet()) attributes.add("text"); return "Cannot build ScheduledMessage, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy