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

org.glowroot.central.repo.ImmutableAgentConfigAndUpdateToken Maven / Gradle / Ivy

package org.glowroot.central.repo;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.CheckReturnValue;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.glowroot.wire.api.model.AgentConfigOuterClass;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link AgentConfigDao.AgentConfigAndUpdateToken}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableAgentConfigAndUpdateToken.builder()}. */ @Generated(from = "AgentConfigDao.AgentConfigAndUpdateToken", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableAgentConfigAndUpdateToken implements AgentConfigDao.AgentConfigAndUpdateToken { private final AgentConfigOuterClass.AgentConfig config; private final java.util.@Nullable UUID updateToken; private ImmutableAgentConfigAndUpdateToken( AgentConfigOuterClass.AgentConfig config, java.util.@Nullable UUID updateToken) { this.config = config; this.updateToken = updateToken; } /** * @return The value of the {@code config} attribute */ @JsonProperty("config") @Override public AgentConfigOuterClass.AgentConfig config() { return config; } /** * @return The value of the {@code updateToken} attribute */ @JsonProperty("updateToken") @Override public java.util.@Nullable UUID updateToken() { return updateToken; } /** * Copy the current immutable object by setting a value for the {@link AgentConfigDao.AgentConfigAndUpdateToken#config() config} 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 config * @return A modified copy of the {@code this} object */ public final ImmutableAgentConfigAndUpdateToken withConfig(AgentConfigOuterClass.AgentConfig value) { if (this.config == value) return this; AgentConfigOuterClass.AgentConfig newValue = Objects.requireNonNull(value, "config"); return new ImmutableAgentConfigAndUpdateToken(newValue, this.updateToken); } /** * Copy the current immutable object by setting a value for the {@link AgentConfigDao.AgentConfigAndUpdateToken#updateToken() updateToken} 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 updateToken (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableAgentConfigAndUpdateToken withUpdateToken(java.util.@Nullable UUID value) { if (this.updateToken == value) return this; return new ImmutableAgentConfigAndUpdateToken(this.config, value); } /** * This instance is equal to all instances of {@code ImmutableAgentConfigAndUpdateToken} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@javax.annotation.Nullable Object another) { if (this == another) return true; return another instanceof ImmutableAgentConfigAndUpdateToken && equalTo((ImmutableAgentConfigAndUpdateToken) another); } private boolean equalTo(ImmutableAgentConfigAndUpdateToken another) { return config.equals(another.config) && Objects.equals(updateToken, another.updateToken); } /** * Computes a hash code from attributes: {@code config}, {@code updateToken}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + config.hashCode(); h += (h << 5) + Objects.hashCode(updateToken); return h; } /** * Prints the immutable value {@code AgentConfigAndUpdateToken} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("AgentConfigAndUpdateToken") .omitNullValues() .add("config", config) .add("updateToken", updateToken) .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 = "AgentConfigDao.AgentConfigAndUpdateToken", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements AgentConfigDao.AgentConfigAndUpdateToken { @javax.annotation.Nullable AgentConfigOuterClass.AgentConfig config; @javax.annotation.Nullable java.util.@Nullable UUID updateToken; @JsonProperty("config") public void setConfig(AgentConfigOuterClass.AgentConfig config) { this.config = config; } @JsonProperty("updateToken") public void setUpdateToken(java.util.@Nullable UUID updateToken) { this.updateToken = updateToken; } @Override public AgentConfigOuterClass.AgentConfig config() { throw new UnsupportedOperationException(); } @Override public java.util.@Nullable UUID updateToken() { 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 ImmutableAgentConfigAndUpdateToken fromJson(Json json) { ImmutableAgentConfigAndUpdateToken.Builder builder = ImmutableAgentConfigAndUpdateToken.builder(); if (json.config != null) { builder.config(json.config); } if (json.updateToken != null) { builder.updateToken(json.updateToken); } return builder.build(); } /** * Creates an immutable copy of a {@link AgentConfigDao.AgentConfigAndUpdateToken} 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 AgentConfigAndUpdateToken instance */ public static ImmutableAgentConfigAndUpdateToken copyOf(AgentConfigDao.AgentConfigAndUpdateToken instance) { if (instance instanceof ImmutableAgentConfigAndUpdateToken) { return (ImmutableAgentConfigAndUpdateToken) instance; } return ImmutableAgentConfigAndUpdateToken.builder() .copyFrom(instance) .build(); } /** * Creates a builder for {@link ImmutableAgentConfigAndUpdateToken ImmutableAgentConfigAndUpdateToken}. *

   * ImmutableAgentConfigAndUpdateToken.builder()
   *    .config(org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig) // required {@link AgentConfigDao.AgentConfigAndUpdateToken#config() config}
   *    .updateToken(@org.checkerframework.checker.nullness.qual.Nullable UUID | null) // nullable {@link AgentConfigDao.AgentConfigAndUpdateToken#updateToken() updateToken}
   *    .build();
   * 
* @return A new ImmutableAgentConfigAndUpdateToken builder */ public static ImmutableAgentConfigAndUpdateToken.Builder builder() { return new ImmutableAgentConfigAndUpdateToken.Builder(); } /** * Builds instances of type {@link ImmutableAgentConfigAndUpdateToken ImmutableAgentConfigAndUpdateToken}. * 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 = "AgentConfigDao.AgentConfigAndUpdateToken", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_CONFIG = 0x1L; private long initBits = 0x1L; private @javax.annotation.Nullable AgentConfigOuterClass.AgentConfig config; private @javax.annotation.Nullable java.util.@Nullable UUID updateToken; private Builder() { } /** * Fill a builder with attribute values from the provided {@code AgentConfigAndUpdateToken} 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 copyFrom(AgentConfigDao.AgentConfigAndUpdateToken instance) { Objects.requireNonNull(instance, "instance"); config(instance.config()); java.util.@Nullable UUID updateTokenValue = instance.updateToken(); if (updateTokenValue != null) { updateToken(updateTokenValue); } return this; } /** * Initializes the value for the {@link AgentConfigDao.AgentConfigAndUpdateToken#config() config} attribute. * @param config The value for config * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder config(AgentConfigOuterClass.AgentConfig config) { this.config = Objects.requireNonNull(config, "config"); initBits &= ~INIT_BIT_CONFIG; return this; } /** * Initializes the value for the {@link AgentConfigDao.AgentConfigAndUpdateToken#updateToken() updateToken} attribute. * @param updateToken The value for updateToken (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder updateToken(java.util.@Nullable UUID updateToken) { this.updateToken = updateToken; return this; } /** * Builds a new {@link ImmutableAgentConfigAndUpdateToken ImmutableAgentConfigAndUpdateToken}. * @return An immutable instance of AgentConfigAndUpdateToken * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableAgentConfigAndUpdateToken build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableAgentConfigAndUpdateToken(config, updateToken); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_CONFIG) != 0) attributes.add("config"); return "Cannot build AgentConfigAndUpdateToken, some of required attributes are not set " + attributes; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy