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

com.hubspot.slack.client.models.files.SlackJavaScriptFile Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.hubspot.immutables.validation.InvalidImmutableStateException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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 SlackJavaScriptFileIF}.
 * 

* Use the builder to create immutable instances: * {@code SlackJavaScriptFile.builder()}. */ @Generated(from = "SlackJavaScriptFileIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class SlackJavaScriptFile implements SlackJavaScriptFileIF { private final String id; private final long createdEpochSeconds; private final long timestampEpochSeconds; private final String name; private final String title; private final String mimetype; private final String prettyType; private final String userId; private final boolean editable; private final long size; private final String mode; private final boolean external; private final boolean isPublic; private final boolean publicUrlShared; private final boolean displayAsBot; private final String username; private final String urlPrivate; private final @Nullable String urlPrivateDownload; private final String permalink; private final @Nullable String permalinkPublic; private final int commentsCount; private final @Nullable Boolean starred; private final List channelIds; private final List groupIds; private final List imIds; private final SlackFileType filetype; private SlackJavaScriptFile(SlackJavaScriptFile.Builder builder) { this.id = builder.id; this.createdEpochSeconds = builder.createdEpochSeconds; this.timestampEpochSeconds = builder.timestampEpochSeconds; this.name = builder.name; this.title = builder.title; this.mimetype = builder.mimetype; this.prettyType = builder.prettyType; this.userId = builder.userId; this.editable = builder.editable; this.size = builder.size; this.mode = builder.mode; this.external = builder.external; this.isPublic = builder.isPublic; this.publicUrlShared = builder.publicUrlShared; this.displayAsBot = builder.displayAsBot; this.username = builder.username; this.urlPrivate = builder.urlPrivate; this.urlPrivateDownload = builder.urlPrivateDownload; this.permalink = builder.permalink; this.permalinkPublic = builder.permalinkPublic; this.starred = builder.starred; this.channelIds = createUnmodifiableList(true, builder.channelIds); this.groupIds = createUnmodifiableList(true, builder.groupIds); this.imIds = createUnmodifiableList(true, builder.imIds); if (builder.commentsCountIsSet()) { initShim.setCommentsCount(builder.commentsCount); } if (builder.filetype != null) { initShim.setFiletype(builder.filetype); } this.commentsCount = initShim.getCommentsCount(); this.filetype = initShim.getFiletype(); this.initShim = null; } private SlackJavaScriptFile( String id, long createdEpochSeconds, long timestampEpochSeconds, String name, String title, String mimetype, String prettyType, String userId, boolean editable, long size, String mode, boolean external, boolean isPublic, boolean publicUrlShared, boolean displayAsBot, String username, String urlPrivate, @Nullable String urlPrivateDownload, String permalink, @Nullable String permalinkPublic, int commentsCount, @Nullable Boolean starred, List channelIds, List groupIds, List imIds, SlackFileType filetype) { this.id = id; this.createdEpochSeconds = createdEpochSeconds; this.timestampEpochSeconds = timestampEpochSeconds; this.name = name; this.title = title; this.mimetype = mimetype; this.prettyType = prettyType; this.userId = userId; this.editable = editable; this.size = size; this.mode = mode; this.external = external; this.isPublic = isPublic; this.publicUrlShared = publicUrlShared; this.displayAsBot = displayAsBot; this.username = username; this.urlPrivate = urlPrivate; this.urlPrivateDownload = urlPrivateDownload; this.permalink = permalink; this.permalinkPublic = permalinkPublic; this.commentsCount = commentsCount; this.starred = starred; this.channelIds = channelIds; this.groupIds = groupIds; this.imIds = imIds; this.filetype = filetype; this.initShim = null; } private static final byte STAGE_INITIALIZING = -1; private static final byte STAGE_UNINITIALIZED = 0; private static final byte STAGE_INITIALIZED = 1; private transient volatile InitShim initShim = new InitShim(); @Generated(from = "SlackJavaScriptFileIF", generator = "Immutables") private final class InitShim { private byte commentsCountBuildStage = STAGE_UNINITIALIZED; private int commentsCount; int getCommentsCount() { if (commentsCountBuildStage == STAGE_INITIALIZING) throw new InvalidImmutableStateException(formatInitCycleMessage()); if (commentsCountBuildStage == STAGE_UNINITIALIZED) { commentsCountBuildStage = STAGE_INITIALIZING; this.commentsCount = getCommentsCountInitialize(); commentsCountBuildStage = STAGE_INITIALIZED; } return this.commentsCount; } void setCommentsCount(int commentsCount) { this.commentsCount = commentsCount; commentsCountBuildStage = STAGE_INITIALIZED; } private byte filetypeBuildStage = STAGE_UNINITIALIZED; private SlackFileType filetype; SlackFileType getFiletype() { if (filetypeBuildStage == STAGE_INITIALIZING) throw new InvalidImmutableStateException(formatInitCycleMessage()); if (filetypeBuildStage == STAGE_UNINITIALIZED) { filetypeBuildStage = STAGE_INITIALIZING; this.filetype = Objects.requireNonNull(getFiletypeInitialize(), "filetype"); filetypeBuildStage = STAGE_INITIALIZED; } return this.filetype; } void setFiletype(SlackFileType filetype) { this.filetype = filetype; filetypeBuildStage = STAGE_INITIALIZED; } private String formatInitCycleMessage() { List attributes = new ArrayList<>(); if (commentsCountBuildStage == STAGE_INITIALIZING) attributes.add("commentsCount"); if (filetypeBuildStage == STAGE_INITIALIZING) attributes.add("filetype"); return "Cannot build SlackJavaScriptFile, attribute initializers form cycle " + attributes; } } private int getCommentsCountInitialize() { return SlackJavaScriptFileIF.super.getCommentsCount(); } private SlackFileType getFiletypeInitialize() { return SlackJavaScriptFileIF.super.getFiletype(); } /** * @return The value of the {@code id} attribute */ @JsonProperty @Override public String getId() { return id; } /** * @return The value of the {@code createdEpochSeconds} attribute */ @JsonProperty("created") @Override public long getCreatedEpochSeconds() { return createdEpochSeconds; } /** * @return The value of the {@code timestampEpochSeconds} attribute */ @JsonProperty("timestamp") @Override public long getTimestampEpochSeconds() { return timestampEpochSeconds; } /** * @return The value of the {@code name} attribute */ @JsonProperty @Override public String getName() { return name; } /** * @return The value of the {@code title} attribute */ @JsonProperty @Override public String getTitle() { return title; } /** * @return The value of the {@code mimetype} attribute */ @JsonProperty @Override public String getMimetype() { return mimetype; } /** * @return The value of the {@code prettyType} attribute */ @JsonProperty @Override public String getPrettyType() { return prettyType; } /** * @return The value of the {@code userId} attribute */ @JsonProperty("user") @Override public String getUserId() { return userId; } /** * @return The value of the {@code editable} attribute */ @JsonProperty @Override public boolean isEditable() { return editable; } /** * @return The value of the {@code size} attribute */ @JsonProperty @Override public long getSize() { return size; } /** * @return The value of the {@code mode} attribute */ @JsonProperty @Override public String getMode() { return mode; } /** * @return The value of the {@code external} attribute */ @JsonProperty("is_external") @Override public boolean isExternal() { return external; } /** * @return The value of the {@code isPublic} attribute */ @JsonProperty("is_public") @Override public boolean isPublic() { return isPublic; } /** * @return The value of the {@code publicUrlShared} attribute */ @JsonProperty @Override public boolean isPublicUrlShared() { return publicUrlShared; } /** * @return The value of the {@code displayAsBot} attribute */ @JsonProperty @Override public boolean getDisplayAsBot() { return displayAsBot; } /** * @return The value of the {@code username} attribute */ @JsonProperty @Override public String getUsername() { return username; } /** * @return The value of the {@code urlPrivate} attribute */ @JsonProperty @Override public String getUrlPrivate() { return urlPrivate; } /** * @return The value of the {@code urlPrivateDownload} attribute */ @JsonProperty @Override public Optional getUrlPrivateDownload() { return Optional.ofNullable(urlPrivateDownload); } /** * @return The value of the {@code permalink} attribute */ @JsonProperty @Override public String getPermalink() { return permalink; } /** * @return The value of the {@code permalinkPublic} attribute */ @JsonProperty @Override public Optional getPermalinkPublic() { return Optional.ofNullable(permalinkPublic); } /** * @return The value of the {@code commentsCount} attribute */ @JsonProperty @Override public int getCommentsCount() { InitShim shim = this.initShim; return shim != null ? shim.getCommentsCount() : this.commentsCount; } /** * @return The value of the {@code starred} attribute */ @JsonProperty("is_starred") @Override public Optional isStarred() { return Optional.ofNullable(starred); } /** * @return The value of the {@code channelIds} attribute */ @JsonProperty("channels") @Override public List getChannelIds() { return channelIds; } /** * @return The value of the {@code groupIds} attribute */ @JsonProperty("groups") @Override public List getGroupIds() { return groupIds; } /** * @return The value of the {@code imIds} attribute */ @JsonProperty("ims") @Override public List getImIds() { return imIds; } /** * @return The value of the {@code filetype} attribute */ @JsonProperty @Override public SlackFileType getFiletype() { InitShim shim = this.initShim; return shim != null ? shim.getFiletype() : this.filetype; } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#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 SlackJavaScriptFile withId(String value) { String newValue = Objects.requireNonNull(value, "id"); if (this.id.equals(newValue)) return this; return new SlackJavaScriptFile( newValue, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getCreatedEpochSeconds() createdEpochSeconds} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for createdEpochSeconds * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withCreatedEpochSeconds(long value) { if (this.createdEpochSeconds == value) return this; return new SlackJavaScriptFile( this.id, value, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getTimestampEpochSeconds() timestampEpochSeconds} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for timestampEpochSeconds * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withTimestampEpochSeconds(long value) { if (this.timestampEpochSeconds == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, value, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withName(String value) { String newValue = Objects.requireNonNull(value, "name"); if (this.name.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, newValue, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getTitle() title} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for title * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withTitle(String value) { String newValue = Objects.requireNonNull(value, "title"); if (this.title.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, newValue, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getMimetype() mimetype} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for mimetype * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withMimetype(String value) { String newValue = Objects.requireNonNull(value, "mimetype"); if (this.mimetype.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, newValue, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getPrettyType() prettyType} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for prettyType * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withPrettyType(String value) { String newValue = Objects.requireNonNull(value, "prettyType"); if (this.prettyType.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, newValue, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getUserId() userId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for userId * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withUserId(String value) { String newValue = Objects.requireNonNull(value, "userId"); if (this.userId.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, newValue, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#isEditable() editable} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for editable * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withEditable(boolean value) { if (this.editable == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, value, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getSize() size} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for size * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withSize(long value) { if (this.size == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, value, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getMode() mode} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for mode * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withMode(String value) { String newValue = Objects.requireNonNull(value, "mode"); if (this.mode.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, newValue, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#isExternal() external} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for external * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withExternal(boolean value) { if (this.external == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, value, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#isPublic() public} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for isPublic * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withPublic(boolean value) { if (this.isPublic == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, value, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#isPublicUrlShared() publicUrlShared} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for publicUrlShared * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withPublicUrlShared(boolean value) { if (this.publicUrlShared == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, value, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getDisplayAsBot() displayAsBot} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for displayAsBot * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withDisplayAsBot(boolean value) { if (this.displayAsBot == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, value, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getUsername() username} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for username * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withUsername(String value) { String newValue = Objects.requireNonNull(value, "username"); if (this.username.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, newValue, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getUrlPrivate() urlPrivate} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for urlPrivate * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withUrlPrivate(String value) { String newValue = Objects.requireNonNull(value, "urlPrivate"); if (this.urlPrivate.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, newValue, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a present value for the optional {@link SlackJavaScriptFileIF#getUrlPrivateDownload() urlPrivateDownload} attribute. * @param value The value for urlPrivateDownload, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withUrlPrivateDownload(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.urlPrivateDownload, newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, newValue, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting an optional value for the {@link SlackJavaScriptFileIF#getUrlPrivateDownload() urlPrivateDownload} 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 urlPrivateDownload * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withUrlPrivateDownload(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.urlPrivateDownload, value)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, value, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getPermalink() permalink} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for permalink * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withPermalink(String value) { String newValue = Objects.requireNonNull(value, "permalink"); if (this.permalink.equals(newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, newValue, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a present value for the optional {@link SlackJavaScriptFileIF#getPermalinkPublic() permalinkPublic} attribute. * @param value The value for permalinkPublic, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withPermalinkPublic(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.permalinkPublic, newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, newValue, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting an optional value for the {@link SlackJavaScriptFileIF#getPermalinkPublic() permalinkPublic} 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 permalinkPublic * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withPermalinkPublic(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.permalinkPublic, value)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, value, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getCommentsCount() commentsCount} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for commentsCount * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withCommentsCount(int value) { if (this.commentsCount == value) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, value, this.starred, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting a present value for the optional {@link SlackJavaScriptFileIF#isStarred() starred} attribute. * @param value The value for starred, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withStarred(@Nullable Boolean value) { @Nullable Boolean newValue = value; if (Objects.equals(this.starred, newValue)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, newValue, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object by setting an optional value for the {@link SlackJavaScriptFileIF#isStarred() starred} 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 starred * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withStarred(Optional optional) { @Nullable Boolean value = optional.orElse(null); if (Objects.equals(this.starred, value)) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, value, this.channelIds, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getChannelIds() channelIds}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withChannelIds(String... elements) { List newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, newValue, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getChannelIds() channelIds}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of channelIds elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withChannelIds(Iterable elements) { if (this.channelIds == elements) return this; List newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, newValue, this.groupIds, this.imIds, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getGroupIds() groupIds}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withGroupIds(String... elements) { List newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, newValue, this.imIds, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getGroupIds() groupIds}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of groupIds elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withGroupIds(Iterable elements) { if (this.groupIds == elements) return this; List newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, newValue, this.imIds, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getImIds() imIds}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withImIds(String... elements) { List newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, newValue, this.filetype); } /** * Copy the current immutable object with elements that replace the content of {@link SlackJavaScriptFileIF#getImIds() imIds}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of imIds elements to set * @return A modified copy of {@code this} object */ public final SlackJavaScriptFile withImIds(Iterable elements) { if (this.imIds == elements) return this; List newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, newValue, this.filetype); } /** * Copy the current immutable object by setting a value for the {@link SlackJavaScriptFileIF#getFiletype() filetype} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for filetype * @return A modified copy of the {@code this} object */ public final SlackJavaScriptFile withFiletype(SlackFileType value) { SlackFileType newValue = Objects.requireNonNull(value, "filetype"); if (this.filetype == newValue) return this; return new SlackJavaScriptFile( this.id, this.createdEpochSeconds, this.timestampEpochSeconds, this.name, this.title, this.mimetype, this.prettyType, this.userId, this.editable, this.size, this.mode, this.external, this.isPublic, this.publicUrlShared, this.displayAsBot, this.username, this.urlPrivate, this.urlPrivateDownload, this.permalink, this.permalinkPublic, this.commentsCount, this.starred, this.channelIds, this.groupIds, this.imIds, newValue); } /** * This instance is equal to all instances of {@code SlackJavaScriptFile} 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 SlackJavaScriptFile && equalTo(0, (SlackJavaScriptFile) another); } private boolean equalTo(int synthetic, SlackJavaScriptFile another) { return id.equals(another.id) && createdEpochSeconds == another.createdEpochSeconds && timestampEpochSeconds == another.timestampEpochSeconds && name.equals(another.name) && title.equals(another.title) && mimetype.equals(another.mimetype) && prettyType.equals(another.prettyType) && userId.equals(another.userId) && editable == another.editable && size == another.size && mode.equals(another.mode) && external == another.external && isPublic == another.isPublic && publicUrlShared == another.publicUrlShared && displayAsBot == another.displayAsBot && username.equals(another.username) && urlPrivate.equals(another.urlPrivate) && Objects.equals(urlPrivateDownload, another.urlPrivateDownload) && permalink.equals(another.permalink) && Objects.equals(permalinkPublic, another.permalinkPublic) && commentsCount == another.commentsCount && Objects.equals(starred, another.starred) && channelIds.equals(another.channelIds) && groupIds.equals(another.groupIds) && imIds.equals(another.imIds) && filetype.equals(another.filetype); } /** * Computes a hash code from attributes: {@code id}, {@code createdEpochSeconds}, {@code timestampEpochSeconds}, {@code name}, {@code title}, {@code mimetype}, {@code prettyType}, {@code userId}, {@code editable}, {@code size}, {@code mode}, {@code external}, {@code isPublic}, {@code publicUrlShared}, {@code displayAsBot}, {@code username}, {@code urlPrivate}, {@code urlPrivateDownload}, {@code permalink}, {@code permalinkPublic}, {@code commentsCount}, {@code starred}, {@code channelIds}, {@code groupIds}, {@code imIds}, {@code filetype}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + id.hashCode(); h += (h << 5) + Long.hashCode(createdEpochSeconds); h += (h << 5) + Long.hashCode(timestampEpochSeconds); h += (h << 5) + name.hashCode(); h += (h << 5) + title.hashCode(); h += (h << 5) + mimetype.hashCode(); h += (h << 5) + prettyType.hashCode(); h += (h << 5) + userId.hashCode(); h += (h << 5) + Boolean.hashCode(editable); h += (h << 5) + Long.hashCode(size); h += (h << 5) + mode.hashCode(); h += (h << 5) + Boolean.hashCode(external); h += (h << 5) + Boolean.hashCode(isPublic); h += (h << 5) + Boolean.hashCode(publicUrlShared); h += (h << 5) + Boolean.hashCode(displayAsBot); h += (h << 5) + username.hashCode(); h += (h << 5) + urlPrivate.hashCode(); h += (h << 5) + Objects.hashCode(urlPrivateDownload); h += (h << 5) + permalink.hashCode(); h += (h << 5) + Objects.hashCode(permalinkPublic); h += (h << 5) + commentsCount; h += (h << 5) + Objects.hashCode(starred); h += (h << 5) + channelIds.hashCode(); h += (h << 5) + groupIds.hashCode(); h += (h << 5) + imIds.hashCode(); h += (h << 5) + filetype.hashCode(); return h; } /** * Prints the immutable value {@code SlackJavaScriptFile} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("SlackJavaScriptFile{"); builder.append("id=").append(id); builder.append(", "); builder.append("createdEpochSeconds=").append(createdEpochSeconds); builder.append(", "); builder.append("timestampEpochSeconds=").append(timestampEpochSeconds); builder.append(", "); builder.append("name=").append(name); builder.append(", "); builder.append("title=").append(title); builder.append(", "); builder.append("mimetype=").append(mimetype); builder.append(", "); builder.append("prettyType=").append(prettyType); builder.append(", "); builder.append("userId=").append(userId); builder.append(", "); builder.append("editable=").append(editable); builder.append(", "); builder.append("size=").append(size); builder.append(", "); builder.append("mode=").append(mode); builder.append(", "); builder.append("external=").append(external); builder.append(", "); builder.append("public=").append(isPublic); builder.append(", "); builder.append("publicUrlShared=").append(publicUrlShared); builder.append(", "); builder.append("displayAsBot=").append(displayAsBot); builder.append(", "); builder.append("username=").append(username); builder.append(", "); builder.append("urlPrivate=").append(urlPrivate); if (urlPrivateDownload != null) { builder.append(", "); builder.append("urlPrivateDownload=").append(urlPrivateDownload); } builder.append(", "); builder.append("permalink=").append(permalink); if (permalinkPublic != null) { builder.append(", "); builder.append("permalinkPublic=").append(permalinkPublic); } builder.append(", "); builder.append("commentsCount=").append(commentsCount); if (starred != null) { builder.append(", "); builder.append("starred=").append(starred); } builder.append(", "); builder.append("channelIds=").append(channelIds); builder.append(", "); builder.append("groupIds=").append(groupIds); builder.append(", "); builder.append("imIds=").append(imIds); builder.append(", "); builder.append("filetype=").append(filetype); 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 = "SlackJavaScriptFileIF", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements SlackJavaScriptFileIF { @Nullable String id; long createdEpochSeconds; boolean createdEpochSecondsIsSet; long timestampEpochSeconds; boolean timestampEpochSecondsIsSet; @Nullable String name; @Nullable String title; @Nullable String mimetype; @Nullable String prettyType; @Nullable String userId; boolean editable; boolean editableIsSet; long size; boolean sizeIsSet; @Nullable String mode; boolean external; boolean externalIsSet; boolean isPublic; boolean isPublicIsSet; boolean publicUrlShared; boolean publicUrlSharedIsSet; boolean displayAsBot; boolean displayAsBotIsSet; @Nullable String username; @Nullable String urlPrivate; @Nullable Optional urlPrivateDownload = Optional.empty(); @Nullable String permalink; @Nullable Optional permalinkPublic = Optional.empty(); int commentsCount; boolean commentsCountIsSet; @Nullable Optional starred = Optional.empty(); @Nullable List channelIds = Collections.emptyList(); @Nullable List groupIds = Collections.emptyList(); @Nullable List imIds = Collections.emptyList(); @Nullable SlackFileType filetype; @JsonProperty public void setId(String id) { this.id = id; } @JsonProperty("created") public void setCreatedEpochSeconds(long createdEpochSeconds) { this.createdEpochSeconds = createdEpochSeconds; this.createdEpochSecondsIsSet = true; } @JsonProperty("timestamp") public void setTimestampEpochSeconds(long timestampEpochSeconds) { this.timestampEpochSeconds = timestampEpochSeconds; this.timestampEpochSecondsIsSet = true; } @JsonProperty public void setName(String name) { this.name = name; } @JsonProperty public void setTitle(String title) { this.title = title; } @JsonProperty public void setMimetype(String mimetype) { this.mimetype = mimetype; } @JsonProperty public void setPrettyType(String prettyType) { this.prettyType = prettyType; } @JsonProperty("user") public void setUserId(String userId) { this.userId = userId; } @JsonProperty public void setEditable(boolean editable) { this.editable = editable; this.editableIsSet = true; } @JsonProperty public void setSize(long size) { this.size = size; this.sizeIsSet = true; } @JsonProperty public void setMode(String mode) { this.mode = mode; } @JsonProperty("is_external") public void setExternal(boolean external) { this.external = external; this.externalIsSet = true; } @JsonProperty("is_public") public void setPublic(boolean isPublic) { this.isPublic = isPublic; this.isPublicIsSet = true; } @JsonProperty public void setPublicUrlShared(boolean publicUrlShared) { this.publicUrlShared = publicUrlShared; this.publicUrlSharedIsSet = true; } @JsonProperty public void setDisplayAsBot(boolean displayAsBot) { this.displayAsBot = displayAsBot; this.displayAsBotIsSet = true; } @JsonProperty public void setUsername(String username) { this.username = username; } @JsonProperty public void setUrlPrivate(String urlPrivate) { this.urlPrivate = urlPrivate; } @JsonProperty public void setUrlPrivateDownload(Optional urlPrivateDownload) { this.urlPrivateDownload = urlPrivateDownload; } @JsonProperty public void setPermalink(String permalink) { this.permalink = permalink; } @JsonProperty public void setPermalinkPublic(Optional permalinkPublic) { this.permalinkPublic = permalinkPublic; } @JsonProperty public void setCommentsCount(int commentsCount) { this.commentsCount = commentsCount; this.commentsCountIsSet = true; } @JsonProperty("is_starred") public void setStarred(Optional starred) { this.starred = starred; } @JsonProperty("channels") public void setChannelIds(List channelIds) { this.channelIds = channelIds; } @JsonProperty("groups") public void setGroupIds(List groupIds) { this.groupIds = groupIds; } @JsonProperty("ims") public void setImIds(List imIds) { this.imIds = imIds; } @JsonProperty public void setFiletype(SlackFileType filetype) { this.filetype = filetype; } @Override public String getId() { throw new UnsupportedOperationException(); } @Override public long getCreatedEpochSeconds() { throw new UnsupportedOperationException(); } @Override public long getTimestampEpochSeconds() { throw new UnsupportedOperationException(); } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public String getTitle() { throw new UnsupportedOperationException(); } @Override public String getMimetype() { throw new UnsupportedOperationException(); } @Override public String getPrettyType() { throw new UnsupportedOperationException(); } @Override public String getUserId() { throw new UnsupportedOperationException(); } @Override public boolean isEditable() { throw new UnsupportedOperationException(); } @Override public long getSize() { throw new UnsupportedOperationException(); } @Override public String getMode() { throw new UnsupportedOperationException(); } @Override public boolean isExternal() { throw new UnsupportedOperationException(); } @Override public boolean isPublic() { throw new UnsupportedOperationException(); } @Override public boolean isPublicUrlShared() { throw new UnsupportedOperationException(); } @Override public boolean getDisplayAsBot() { throw new UnsupportedOperationException(); } @Override public String getUsername() { throw new UnsupportedOperationException(); } @Override public String getUrlPrivate() { throw new UnsupportedOperationException(); } @Override public Optional getUrlPrivateDownload() { throw new UnsupportedOperationException(); } @Override public String getPermalink() { throw new UnsupportedOperationException(); } @Override public Optional getPermalinkPublic() { throw new UnsupportedOperationException(); } @Override public int getCommentsCount() { throw new UnsupportedOperationException(); } @Override public Optional isStarred() { throw new UnsupportedOperationException(); } @Override public List getChannelIds() { throw new UnsupportedOperationException(); } @Override public List getGroupIds() { throw new UnsupportedOperationException(); } @Override public List getImIds() { throw new UnsupportedOperationException(); } @Override public SlackFileType getFiletype() { 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 SlackJavaScriptFile fromJson(Json json) { SlackJavaScriptFile.Builder builder = SlackJavaScriptFile.builder(); if (json.id != null) { builder.setId(json.id); } if (json.createdEpochSecondsIsSet) { builder.setCreatedEpochSeconds(json.createdEpochSeconds); } if (json.timestampEpochSecondsIsSet) { builder.setTimestampEpochSeconds(json.timestampEpochSeconds); } if (json.name != null) { builder.setName(json.name); } if (json.title != null) { builder.setTitle(json.title); } if (json.mimetype != null) { builder.setMimetype(json.mimetype); } if (json.prettyType != null) { builder.setPrettyType(json.prettyType); } if (json.userId != null) { builder.setUserId(json.userId); } if (json.editableIsSet) { builder.setEditable(json.editable); } if (json.sizeIsSet) { builder.setSize(json.size); } if (json.mode != null) { builder.setMode(json.mode); } if (json.externalIsSet) { builder.setExternal(json.external); } if (json.isPublicIsSet) { builder.setPublic(json.isPublic); } if (json.publicUrlSharedIsSet) { builder.setPublicUrlShared(json.publicUrlShared); } if (json.displayAsBotIsSet) { builder.setDisplayAsBot(json.displayAsBot); } if (json.username != null) { builder.setUsername(json.username); } if (json.urlPrivate != null) { builder.setUrlPrivate(json.urlPrivate); } if (json.urlPrivateDownload != null) { builder.setUrlPrivateDownload(json.urlPrivateDownload); } if (json.permalink != null) { builder.setPermalink(json.permalink); } if (json.permalinkPublic != null) { builder.setPermalinkPublic(json.permalinkPublic); } if (json.commentsCountIsSet) { builder.setCommentsCount(json.commentsCount); } if (json.starred != null) { builder.setStarred(json.starred); } if (json.channelIds != null) { builder.addAllChannelIds(json.channelIds); } if (json.groupIds != null) { builder.addAllGroupIds(json.groupIds); } if (json.imIds != null) { builder.addAllImIds(json.imIds); } if (json.filetype != null) { builder.setFiletype(json.filetype); } return builder.build(); } /** * Creates an immutable copy of a {@link SlackJavaScriptFileIF} 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 SlackJavaScriptFile instance */ public static SlackJavaScriptFile copyOf(SlackJavaScriptFileIF instance) { if (instance instanceof SlackJavaScriptFile) { return (SlackJavaScriptFile) instance; } return SlackJavaScriptFile.builder() .from(instance) .build(); } /** * Creates a builder for {@link SlackJavaScriptFile SlackJavaScriptFile}. *

   * SlackJavaScriptFile.builder()
   *    .setId(String) // required {@link SlackJavaScriptFileIF#getId() id}
   *    .setCreatedEpochSeconds(long) // required {@link SlackJavaScriptFileIF#getCreatedEpochSeconds() createdEpochSeconds}
   *    .setTimestampEpochSeconds(long) // required {@link SlackJavaScriptFileIF#getTimestampEpochSeconds() timestampEpochSeconds}
   *    .setName(String) // required {@link SlackJavaScriptFileIF#getName() name}
   *    .setTitle(String) // required {@link SlackJavaScriptFileIF#getTitle() title}
   *    .setMimetype(String) // required {@link SlackJavaScriptFileIF#getMimetype() mimetype}
   *    .setPrettyType(String) // required {@link SlackJavaScriptFileIF#getPrettyType() prettyType}
   *    .setUserId(String) // required {@link SlackJavaScriptFileIF#getUserId() userId}
   *    .setEditable(boolean) // required {@link SlackJavaScriptFileIF#isEditable() editable}
   *    .setSize(long) // required {@link SlackJavaScriptFileIF#getSize() size}
   *    .setMode(String) // required {@link SlackJavaScriptFileIF#getMode() mode}
   *    .setExternal(boolean) // required {@link SlackJavaScriptFileIF#isExternal() external}
   *    .setPublic(boolean) // required {@link SlackJavaScriptFileIF#isPublic() public}
   *    .setPublicUrlShared(boolean) // required {@link SlackJavaScriptFileIF#isPublicUrlShared() publicUrlShared}
   *    .setDisplayAsBot(boolean) // required {@link SlackJavaScriptFileIF#getDisplayAsBot() displayAsBot}
   *    .setUsername(String) // required {@link SlackJavaScriptFileIF#getUsername() username}
   *    .setUrlPrivate(String) // required {@link SlackJavaScriptFileIF#getUrlPrivate() urlPrivate}
   *    .setUrlPrivateDownload(String) // optional {@link SlackJavaScriptFileIF#getUrlPrivateDownload() urlPrivateDownload}
   *    .setPermalink(String) // required {@link SlackJavaScriptFileIF#getPermalink() permalink}
   *    .setPermalinkPublic(String) // optional {@link SlackJavaScriptFileIF#getPermalinkPublic() permalinkPublic}
   *    .setCommentsCount(int) // optional {@link SlackJavaScriptFileIF#getCommentsCount() commentsCount}
   *    .setStarred(Boolean) // optional {@link SlackJavaScriptFileIF#isStarred() starred}
   *    .addChannelIds|addAllChannelIds(String) // {@link SlackJavaScriptFileIF#getChannelIds() channelIds} elements
   *    .addGroupIds|addAllGroupIds(String) // {@link SlackJavaScriptFileIF#getGroupIds() groupIds} elements
   *    .addImIds|addAllImIds(String) // {@link SlackJavaScriptFileIF#getImIds() imIds} elements
   *    .setFiletype(com.hubspot.slack.client.models.files.SlackFileType) // optional {@link SlackJavaScriptFileIF#getFiletype() filetype}
   *    .build();
   * 
* @return A new SlackJavaScriptFile builder */ public static SlackJavaScriptFile.Builder builder() { return new SlackJavaScriptFile.Builder(); } /** * Builds instances of type {@link SlackJavaScriptFile SlackJavaScriptFile}. * 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 = "SlackJavaScriptFileIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_ID = 0x1L; private static final long INIT_BIT_CREATED_EPOCH_SECONDS = 0x2L; private static final long INIT_BIT_TIMESTAMP_EPOCH_SECONDS = 0x4L; private static final long INIT_BIT_NAME = 0x8L; private static final long INIT_BIT_TITLE = 0x10L; private static final long INIT_BIT_MIMETYPE = 0x20L; private static final long INIT_BIT_PRETTY_TYPE = 0x40L; private static final long INIT_BIT_USER_ID = 0x80L; private static final long INIT_BIT_EDITABLE = 0x100L; private static final long INIT_BIT_SIZE = 0x200L; private static final long INIT_BIT_MODE = 0x400L; private static final long INIT_BIT_EXTERNAL = 0x800L; private static final long INIT_BIT_IS_PUBLIC = 0x1000L; private static final long INIT_BIT_PUBLIC_URL_SHARED = 0x2000L; private static final long INIT_BIT_DISPLAY_AS_BOT = 0x4000L; private static final long INIT_BIT_USERNAME = 0x8000L; private static final long INIT_BIT_URL_PRIVATE = 0x10000L; private static final long INIT_BIT_PERMALINK = 0x20000L; private static final long OPT_BIT_COMMENTS_COUNT = 0x1L; private long initBits = 0x3ffffL; private long optBits; private @Nullable String id; private long createdEpochSeconds; private long timestampEpochSeconds; private @Nullable String name; private @Nullable String title; private @Nullable String mimetype; private @Nullable String prettyType; private @Nullable String userId; private boolean editable; private long size; private @Nullable String mode; private boolean external; private boolean isPublic; private boolean publicUrlShared; private boolean displayAsBot; private @Nullable String username; private @Nullable String urlPrivate; private @Nullable String urlPrivateDownload; private @Nullable String permalink; private @Nullable String permalinkPublic; private int commentsCount; private @Nullable Boolean starred; private List channelIds = new ArrayList(); private List groupIds = new ArrayList(); private List imIds = new ArrayList(); private @Nullable SlackFileType filetype; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.files.SlackFile} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SlackFile 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.files.SlackJavaScriptFileIF} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SlackJavaScriptFileIF 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 SlackFile) { SlackFile instance = (SlackFile) object; if ((bits & 0x1L) == 0) { this.setFiletype(instance.getFiletype()); bits |= 0x1L; } if ((bits & 0x2L) == 0) { this.setTitle(instance.getTitle()); bits |= 0x2L; } if ((bits & 0x4L) == 0) { this.setDisplayAsBot(instance.getDisplayAsBot()); bits |= 0x4L; } if ((bits & 0x8L) == 0) { addAllImIds(instance.getImIds()); bits |= 0x8L; } if ((bits & 0x10L) == 0) { Optional urlPrivateDownloadOptional = instance.getUrlPrivateDownload(); if (urlPrivateDownloadOptional.isPresent()) { setUrlPrivateDownload(urlPrivateDownloadOptional); } bits |= 0x10L; } if ((bits & 0x20L) == 0) { this.setMode(instance.getMode()); bits |= 0x20L; } if ((bits & 0x40L) == 0) { Optional starredOptional = instance.isStarred(); if (starredOptional.isPresent()) { setStarred(starredOptional); } bits |= 0x40L; } if ((bits & 0x80L) == 0) { this.setUrlPrivate(instance.getUrlPrivate()); bits |= 0x80L; } if ((bits & 0x100L) == 0) { this.setPrettyType(instance.getPrettyType()); bits |= 0x100L; } if ((bits & 0x200L) == 0) { addAllGroupIds(instance.getGroupIds()); bits |= 0x200L; } if ((bits & 0x400L) == 0) { this.setPublicUrlShared(instance.isPublicUrlShared()); bits |= 0x400L; } if ((bits & 0x800L) == 0) { this.setTimestampEpochSeconds(instance.getTimestampEpochSeconds()); bits |= 0x800L; } if ((bits & 0x1000L) == 0) { this.setPublic(instance.isPublic()); bits |= 0x1000L; } if ((bits & 0x2000L) == 0) { this.setId(instance.getId()); bits |= 0x2000L; } if ((bits & 0x4000L) == 0) { addAllChannelIds(instance.getChannelIds()); bits |= 0x4000L; } if ((bits & 0x8000L) == 0) { this.setCreatedEpochSeconds(instance.getCreatedEpochSeconds()); bits |= 0x8000L; } if ((bits & 0x10000L) == 0) { this.setEditable(instance.isEditable()); bits |= 0x10000L; } if ((bits & 0x20000L) == 0) { this.setUserId(instance.getUserId()); bits |= 0x20000L; } if ((bits & 0x40000L) == 0) { this.setExternal(instance.isExternal()); bits |= 0x40000L; } if ((bits & 0x80000L) == 0) { this.setSize(instance.getSize()); bits |= 0x80000L; } if ((bits & 0x100000L) == 0) { this.setCommentsCount(instance.getCommentsCount()); bits |= 0x100000L; } if ((bits & 0x200000L) == 0) { this.setName(instance.getName()); bits |= 0x200000L; } if ((bits & 0x400000L) == 0) { this.setMimetype(instance.getMimetype()); bits |= 0x400000L; } if ((bits & 0x800000L) == 0) { Optional permalinkPublicOptional = instance.getPermalinkPublic(); if (permalinkPublicOptional.isPresent()) { setPermalinkPublic(permalinkPublicOptional); } bits |= 0x800000L; } if ((bits & 0x1000000L) == 0) { this.setPermalink(instance.getPermalink()); bits |= 0x1000000L; } if ((bits & 0x2000000L) == 0) { this.setUsername(instance.getUsername()); bits |= 0x2000000L; } } if (object instanceof SlackJavaScriptFileIF) { SlackJavaScriptFileIF instance = (SlackJavaScriptFileIF) object; if ((bits & 0x1L) == 0) { this.setFiletype(instance.getFiletype()); bits |= 0x1L; } if ((bits & 0x2L) == 0) { this.setTitle(instance.getTitle()); bits |= 0x2L; } if ((bits & 0x4L) == 0) { this.setDisplayAsBot(instance.getDisplayAsBot()); bits |= 0x4L; } if ((bits & 0x8L) == 0) { addAllImIds(instance.getImIds()); bits |= 0x8L; } if ((bits & 0x10L) == 0) { Optional urlPrivateDownloadOptional = instance.getUrlPrivateDownload(); if (urlPrivateDownloadOptional.isPresent()) { setUrlPrivateDownload(urlPrivateDownloadOptional); } bits |= 0x10L; } if ((bits & 0x20L) == 0) { this.setMode(instance.getMode()); bits |= 0x20L; } if ((bits & 0x40L) == 0) { Optional starredOptional = instance.isStarred(); if (starredOptional.isPresent()) { setStarred(starredOptional); } bits |= 0x40L; } if ((bits & 0x80L) == 0) { this.setUrlPrivate(instance.getUrlPrivate()); bits |= 0x80L; } if ((bits & 0x100L) == 0) { this.setPrettyType(instance.getPrettyType()); bits |= 0x100L; } if ((bits & 0x200L) == 0) { addAllGroupIds(instance.getGroupIds()); bits |= 0x200L; } if ((bits & 0x400L) == 0) { this.setPublicUrlShared(instance.isPublicUrlShared()); bits |= 0x400L; } if ((bits & 0x800L) == 0) { this.setTimestampEpochSeconds(instance.getTimestampEpochSeconds()); bits |= 0x800L; } if ((bits & 0x1000L) == 0) { this.setPublic(instance.isPublic()); bits |= 0x1000L; } if ((bits & 0x2000L) == 0) { this.setId(instance.getId()); bits |= 0x2000L; } if ((bits & 0x4000L) == 0) { addAllChannelIds(instance.getChannelIds()); bits |= 0x4000L; } if ((bits & 0x8000L) == 0) { this.setCreatedEpochSeconds(instance.getCreatedEpochSeconds()); bits |= 0x8000L; } if ((bits & 0x10000L) == 0) { this.setEditable(instance.isEditable()); bits |= 0x10000L; } if ((bits & 0x20000L) == 0) { this.setUserId(instance.getUserId()); bits |= 0x20000L; } if ((bits & 0x40000L) == 0) { this.setExternal(instance.isExternal()); bits |= 0x40000L; } if ((bits & 0x80000L) == 0) { this.setSize(instance.getSize()); bits |= 0x80000L; } if ((bits & 0x100000L) == 0) { this.setCommentsCount(instance.getCommentsCount()); bits |= 0x100000L; } if ((bits & 0x200000L) == 0) { this.setName(instance.getName()); bits |= 0x200000L; } if ((bits & 0x400000L) == 0) { this.setMimetype(instance.getMimetype()); bits |= 0x400000L; } if ((bits & 0x800000L) == 0) { Optional permalinkPublicOptional = instance.getPermalinkPublic(); if (permalinkPublicOptional.isPresent()) { setPermalinkPublic(permalinkPublicOptional); } bits |= 0x800000L; } if ((bits & 0x1000000L) == 0) { this.setPermalink(instance.getPermalink()); bits |= 0x1000000L; } if ((bits & 0x2000000L) == 0) { this.setUsername(instance.getUsername()); bits |= 0x2000000L; } } } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getId() id} attribute. * @param id The value for id * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setId(String id) { this.id = Objects.requireNonNull(id, "id"); initBits &= ~INIT_BIT_ID; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getCreatedEpochSeconds() createdEpochSeconds} attribute. * @param createdEpochSeconds The value for createdEpochSeconds * @return {@code this} builder for use in a chained invocation */ @JsonProperty("created") public final Builder setCreatedEpochSeconds(long createdEpochSeconds) { this.createdEpochSeconds = createdEpochSeconds; initBits &= ~INIT_BIT_CREATED_EPOCH_SECONDS; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getTimestampEpochSeconds() timestampEpochSeconds} attribute. * @param timestampEpochSeconds The value for timestampEpochSeconds * @return {@code this} builder for use in a chained invocation */ @JsonProperty("timestamp") public final Builder setTimestampEpochSeconds(long timestampEpochSeconds) { this.timestampEpochSeconds = timestampEpochSeconds; initBits &= ~INIT_BIT_TIMESTAMP_EPOCH_SECONDS; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getName() name} attribute. * @param name The value for name * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setName(String name) { this.name = Objects.requireNonNull(name, "name"); initBits &= ~INIT_BIT_NAME; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getTitle() title} attribute. * @param title The value for title * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setTitle(String title) { this.title = Objects.requireNonNull(title, "title"); initBits &= ~INIT_BIT_TITLE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getMimetype() mimetype} attribute. * @param mimetype The value for mimetype * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setMimetype(String mimetype) { this.mimetype = Objects.requireNonNull(mimetype, "mimetype"); initBits &= ~INIT_BIT_MIMETYPE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getPrettyType() prettyType} attribute. * @param prettyType The value for prettyType * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setPrettyType(String prettyType) { this.prettyType = Objects.requireNonNull(prettyType, "prettyType"); initBits &= ~INIT_BIT_PRETTY_TYPE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getUserId() userId} attribute. * @param userId The value for userId * @return {@code this} builder for use in a chained invocation */ @JsonProperty("user") public final Builder setUserId(String userId) { this.userId = Objects.requireNonNull(userId, "userId"); initBits &= ~INIT_BIT_USER_ID; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#isEditable() editable} attribute. * @param editable The value for editable * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setEditable(boolean editable) { this.editable = editable; initBits &= ~INIT_BIT_EDITABLE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getSize() size} attribute. * @param size The value for size * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setSize(long size) { this.size = size; initBits &= ~INIT_BIT_SIZE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getMode() mode} attribute. * @param mode The value for mode * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setMode(String mode) { this.mode = Objects.requireNonNull(mode, "mode"); initBits &= ~INIT_BIT_MODE; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#isExternal() external} attribute. * @param external The value for external * @return {@code this} builder for use in a chained invocation */ @JsonProperty("is_external") public final Builder setExternal(boolean external) { this.external = external; initBits &= ~INIT_BIT_EXTERNAL; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#isPublic() public} attribute. * @param isPublic The value for isPublic * @return {@code this} builder for use in a chained invocation */ @JsonProperty("is_public") public final Builder setPublic(boolean isPublic) { this.isPublic = isPublic; initBits &= ~INIT_BIT_IS_PUBLIC; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#isPublicUrlShared() publicUrlShared} attribute. * @param publicUrlShared The value for publicUrlShared * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setPublicUrlShared(boolean publicUrlShared) { this.publicUrlShared = publicUrlShared; initBits &= ~INIT_BIT_PUBLIC_URL_SHARED; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getDisplayAsBot() displayAsBot} attribute. * @param displayAsBot The value for displayAsBot * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setDisplayAsBot(boolean displayAsBot) { this.displayAsBot = displayAsBot; initBits &= ~INIT_BIT_DISPLAY_AS_BOT; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getUsername() username} attribute. * @param username The value for username * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setUsername(String username) { this.username = Objects.requireNonNull(username, "username"); initBits &= ~INIT_BIT_USERNAME; return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getUrlPrivate() urlPrivate} attribute. * @param urlPrivate The value for urlPrivate * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setUrlPrivate(String urlPrivate) { this.urlPrivate = Objects.requireNonNull(urlPrivate, "urlPrivate"); initBits &= ~INIT_BIT_URL_PRIVATE; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#getUrlPrivateDownload() urlPrivateDownload} to urlPrivateDownload. * @param urlPrivateDownload The value for urlPrivateDownload, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setUrlPrivateDownload(@Nullable String urlPrivateDownload) { this.urlPrivateDownload = urlPrivateDownload; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#getUrlPrivateDownload() urlPrivateDownload} to urlPrivateDownload. * @param urlPrivateDownload The value for urlPrivateDownload * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setUrlPrivateDownload(Optional urlPrivateDownload) { this.urlPrivateDownload = urlPrivateDownload.orElse(null); return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getPermalink() permalink} attribute. * @param permalink The value for permalink * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setPermalink(String permalink) { this.permalink = Objects.requireNonNull(permalink, "permalink"); initBits &= ~INIT_BIT_PERMALINK; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#getPermalinkPublic() permalinkPublic} to permalinkPublic. * @param permalinkPublic The value for permalinkPublic, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setPermalinkPublic(@Nullable String permalinkPublic) { this.permalinkPublic = permalinkPublic; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#getPermalinkPublic() permalinkPublic} to permalinkPublic. * @param permalinkPublic The value for permalinkPublic * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setPermalinkPublic(Optional permalinkPublic) { this.permalinkPublic = permalinkPublic.orElse(null); return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getCommentsCount() commentsCount} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SlackJavaScriptFileIF#getCommentsCount() commentsCount}. * @param commentsCount The value for commentsCount * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setCommentsCount(int commentsCount) { this.commentsCount = commentsCount; optBits |= OPT_BIT_COMMENTS_COUNT; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#isStarred() starred} to starred. * @param starred The value for starred, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setStarred(@Nullable Boolean starred) { this.starred = starred; return this; } /** * Initializes the optional value {@link SlackJavaScriptFileIF#isStarred() starred} to starred. * @param starred The value for starred * @return {@code this} builder for use in a chained invocation */ @JsonProperty("is_starred") public final Builder setStarred(Optional starred) { this.starred = starred.orElse(null); return this; } /** * Adds one element to {@link SlackJavaScriptFileIF#getChannelIds() channelIds} list. * @param element A channelIds element * @return {@code this} builder for use in a chained invocation */ public final Builder addChannelIds(String element) { this.channelIds.add(Objects.requireNonNull(element, "channelIds element")); return this; } /** * Adds elements to {@link SlackJavaScriptFileIF#getChannelIds() channelIds} list. * @param elements An array of channelIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addChannelIds(String... elements) { for (String element : elements) { this.channelIds.add(Objects.requireNonNull(element, "channelIds element")); } return this; } /** * Sets or replaces all elements for {@link SlackJavaScriptFileIF#getChannelIds() channelIds} list. * @param elements An iterable of channelIds elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("channels") public final Builder setChannelIds(Iterable elements) { this.channelIds.clear(); return addAllChannelIds(elements); } /** * Adds elements to {@link SlackJavaScriptFileIF#getChannelIds() channelIds} list. * @param elements An iterable of channelIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllChannelIds(Iterable elements) { for (String element : elements) { this.channelIds.add(Objects.requireNonNull(element, "channelIds element")); } return this; } /** * Adds one element to {@link SlackJavaScriptFileIF#getGroupIds() groupIds} list. * @param element A groupIds element * @return {@code this} builder for use in a chained invocation */ public final Builder addGroupIds(String element) { this.groupIds.add(Objects.requireNonNull(element, "groupIds element")); return this; } /** * Adds elements to {@link SlackJavaScriptFileIF#getGroupIds() groupIds} list. * @param elements An array of groupIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addGroupIds(String... elements) { for (String element : elements) { this.groupIds.add(Objects.requireNonNull(element, "groupIds element")); } return this; } /** * Sets or replaces all elements for {@link SlackJavaScriptFileIF#getGroupIds() groupIds} list. * @param elements An iterable of groupIds elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("groups") public final Builder setGroupIds(Iterable elements) { this.groupIds.clear(); return addAllGroupIds(elements); } /** * Adds elements to {@link SlackJavaScriptFileIF#getGroupIds() groupIds} list. * @param elements An iterable of groupIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllGroupIds(Iterable elements) { for (String element : elements) { this.groupIds.add(Objects.requireNonNull(element, "groupIds element")); } return this; } /** * Adds one element to {@link SlackJavaScriptFileIF#getImIds() imIds} list. * @param element A imIds element * @return {@code this} builder for use in a chained invocation */ public final Builder addImIds(String element) { this.imIds.add(Objects.requireNonNull(element, "imIds element")); return this; } /** * Adds elements to {@link SlackJavaScriptFileIF#getImIds() imIds} list. * @param elements An array of imIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addImIds(String... elements) { for (String element : elements) { this.imIds.add(Objects.requireNonNull(element, "imIds element")); } return this; } /** * Sets or replaces all elements for {@link SlackJavaScriptFileIF#getImIds() imIds} list. * @param elements An iterable of imIds elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("ims") public final Builder setImIds(Iterable elements) { this.imIds.clear(); return addAllImIds(elements); } /** * Adds elements to {@link SlackJavaScriptFileIF#getImIds() imIds} list. * @param elements An iterable of imIds elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllImIds(Iterable elements) { for (String element : elements) { this.imIds.add(Objects.requireNonNull(element, "imIds element")); } return this; } /** * Initializes the value for the {@link SlackJavaScriptFileIF#getFiletype() filetype} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SlackJavaScriptFileIF#getFiletype() filetype}. * @param filetype The value for filetype * @return {@code this} builder for use in a chained invocation */ @JsonProperty public final Builder setFiletype(SlackFileType filetype) { this.filetype = Objects.requireNonNull(filetype, "filetype"); return this; } /** * Builds a new {@link SlackJavaScriptFile SlackJavaScriptFile}. * @return An immutable instance of SlackJavaScriptFile * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public SlackJavaScriptFile build() { checkRequiredAttributes(); return new SlackJavaScriptFile(this); } private boolean commentsCountIsSet() { return (optBits & OPT_BIT_COMMENTS_COUNT) != 0; } private boolean idIsSet() { return (initBits & INIT_BIT_ID) == 0; } private boolean createdEpochSecondsIsSet() { return (initBits & INIT_BIT_CREATED_EPOCH_SECONDS) == 0; } private boolean timestampEpochSecondsIsSet() { return (initBits & INIT_BIT_TIMESTAMP_EPOCH_SECONDS) == 0; } private boolean nameIsSet() { return (initBits & INIT_BIT_NAME) == 0; } private boolean titleIsSet() { return (initBits & INIT_BIT_TITLE) == 0; } private boolean mimetypeIsSet() { return (initBits & INIT_BIT_MIMETYPE) == 0; } private boolean prettyTypeIsSet() { return (initBits & INIT_BIT_PRETTY_TYPE) == 0; } private boolean userIdIsSet() { return (initBits & INIT_BIT_USER_ID) == 0; } private boolean editableIsSet() { return (initBits & INIT_BIT_EDITABLE) == 0; } private boolean sizeIsSet() { return (initBits & INIT_BIT_SIZE) == 0; } private boolean modeIsSet() { return (initBits & INIT_BIT_MODE) == 0; } private boolean externalIsSet() { return (initBits & INIT_BIT_EXTERNAL) == 0; } private boolean publicIsSet() { return (initBits & INIT_BIT_IS_PUBLIC) == 0; } private boolean publicUrlSharedIsSet() { return (initBits & INIT_BIT_PUBLIC_URL_SHARED) == 0; } private boolean displayAsBotIsSet() { return (initBits & INIT_BIT_DISPLAY_AS_BOT) == 0; } private boolean usernameIsSet() { return (initBits & INIT_BIT_USERNAME) == 0; } private boolean urlPrivateIsSet() { return (initBits & INIT_BIT_URL_PRIVATE) == 0; } private boolean permalinkIsSet() { return (initBits & INIT_BIT_PERMALINK) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!idIsSet()) attributes.add("id"); if (!createdEpochSecondsIsSet()) attributes.add("createdEpochSeconds"); if (!timestampEpochSecondsIsSet()) attributes.add("timestampEpochSeconds"); if (!nameIsSet()) attributes.add("name"); if (!titleIsSet()) attributes.add("title"); if (!mimetypeIsSet()) attributes.add("mimetype"); if (!prettyTypeIsSet()) attributes.add("prettyType"); if (!userIdIsSet()) attributes.add("userId"); if (!editableIsSet()) attributes.add("editable"); if (!sizeIsSet()) attributes.add("size"); if (!modeIsSet()) attributes.add("mode"); if (!externalIsSet()) attributes.add("external"); if (!publicIsSet()) attributes.add("public"); if (!publicUrlSharedIsSet()) attributes.add("publicUrlShared"); if (!displayAsBotIsSet()) attributes.add("displayAsBot"); if (!usernameIsSet()) attributes.add("username"); if (!urlPrivateIsSet()) attributes.add("urlPrivate"); if (!permalinkIsSet()) attributes.add("permalink"); return "Cannot build SlackJavaScriptFile, some of required attributes are not set " + attributes; } } private static List createSafeList(Iterable iterable, boolean checkNulls, boolean skipNulls) { ArrayList list; if (iterable instanceof Collection) { int size = ((Collection) iterable).size(); if (size == 0) return Collections.emptyList(); list = new ArrayList<>(size); } else { list = new ArrayList<>(); } for (T element : iterable) { if (skipNulls && element == null) continue; if (checkNulls) Objects.requireNonNull(element, "element"); list.add(element); } return list; } private static List createUnmodifiableList(boolean clone, List list) { switch(list.size()) { case 0: return Collections.emptyList(); case 1: return Collections.singletonList(list.get(0)); default: if (clone) { return Collections.unmodifiableList(new ArrayList<>(list)); } else { if (list instanceof ArrayList) { ((ArrayList) list).trimToSize(); } return Collections.unmodifiableList(list); } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy