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

com.github.princesslana.eriscasper.data.event.ImmutableGuildIntegrationsUpdateEventData Maven / Gradle / Ivy

The newest version!
package com.github.princesslana.eriscasper.data.event;

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.github.princesslana.eriscasper.data.Snowflake;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List;
import java.util.Objects;
import javax.annotation.CheckReturnValue;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;

/**
 * Immutable implementation of {@link GuildIntegrationsUpdateEventData}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableGuildIntegrationsUpdateEventData.builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "GuildIntegrationsUpdateEventData"}) @Immutable @CheckReturnValue public final class ImmutableGuildIntegrationsUpdateEventData implements GuildIntegrationsUpdateEventData { private final Snowflake guildId; private ImmutableGuildIntegrationsUpdateEventData(Snowflake guildId) { this.guildId = guildId; } /** * id of the guild whose integrations were updated */ @JsonProperty("guild_id") @Override public Snowflake getGuildId() { return guildId; } /** * Copy the current immutable object by setting a value for the {@link GuildIntegrationsUpdateEventData#getGuildId() guildId} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for guildId * @return A modified copy of the {@code this} object */ public final ImmutableGuildIntegrationsUpdateEventData withGuildId(Snowflake value) { if (this.guildId == value) return this; Snowflake newValue = Objects.requireNonNull(value, "guildId"); return new ImmutableGuildIntegrationsUpdateEventData(newValue); } /** * This instance is equal to all instances of {@code ImmutableGuildIntegrationsUpdateEventData} 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 ImmutableGuildIntegrationsUpdateEventData && equalTo((ImmutableGuildIntegrationsUpdateEventData) another); } private boolean equalTo(ImmutableGuildIntegrationsUpdateEventData another) { return guildId.equals(another.guildId); } /** * Computes a hash code from attributes: {@code guildId}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + guildId.hashCode(); return h; } /** * Prints the immutable value {@code GuildIntegrationsUpdateEventData} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("GuildIntegrationsUpdateEventData") .omitNullValues() .add("guildId", guildId) .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 */ @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements GuildIntegrationsUpdateEventData { @Nullable Snowflake guildId; @JsonProperty("guild_id") public void setGuildId(Snowflake guildId) { this.guildId = guildId; } @Override public Snowflake getGuildId() { 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 ImmutableGuildIntegrationsUpdateEventData fromJson(Json json) { ImmutableGuildIntegrationsUpdateEventData.Builder builder = ImmutableGuildIntegrationsUpdateEventData.builder(); if (json.guildId != null) { builder.guildId(json.guildId); } return builder.build(); } /** * Creates an immutable copy of a {@link GuildIntegrationsUpdateEventData} 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 GuildIntegrationsUpdateEventData instance */ public static ImmutableGuildIntegrationsUpdateEventData copyOf(GuildIntegrationsUpdateEventData instance) { if (instance instanceof ImmutableGuildIntegrationsUpdateEventData) { return (ImmutableGuildIntegrationsUpdateEventData) instance; } return ImmutableGuildIntegrationsUpdateEventData.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableGuildIntegrationsUpdateEventData ImmutableGuildIntegrationsUpdateEventData}. * @return A new ImmutableGuildIntegrationsUpdateEventData builder */ public static ImmutableGuildIntegrationsUpdateEventData.Builder builder() { return new ImmutableGuildIntegrationsUpdateEventData.Builder(); } /** * Builds instances of type {@link ImmutableGuildIntegrationsUpdateEventData ImmutableGuildIntegrationsUpdateEventData}. * 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. */ @NotThreadSafe public static final class Builder { private static final long INIT_BIT_GUILD_ID = 0x1L; private long initBits = 0x1L; private @Nullable Snowflake guildId; private Builder() { } /** * Fill a builder with attribute values from the provided {@code GuildIntegrationsUpdateEventData} 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 */ @CanIgnoreReturnValue public final Builder from(GuildIntegrationsUpdateEventData instance) { Objects.requireNonNull(instance, "instance"); guildId(instance.getGuildId()); return this; } /** * Initializes the value for the {@link GuildIntegrationsUpdateEventData#getGuildId() guildId} attribute. * @param guildId The value for guildId * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("guild_id") public final Builder guildId(Snowflake guildId) { this.guildId = Objects.requireNonNull(guildId, "guildId"); initBits &= ~INIT_BIT_GUILD_ID; return this; } /** * Builds a new {@link ImmutableGuildIntegrationsUpdateEventData ImmutableGuildIntegrationsUpdateEventData}. * @return An immutable instance of GuildIntegrationsUpdateEventData * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableGuildIntegrationsUpdateEventData build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableGuildIntegrationsUpdateEventData(guildId); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_GUILD_ID) != 0) attributes.add("guildId"); return "Cannot build GuildIntegrationsUpdateEventData, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy