org.glowroot.central.repo.ImmutableAgentRollupIdSyntheticMonitorIdPair 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.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair}.
*
* Use the builder to create immutable instances:
* {@code ImmutableAgentRollupIdSyntheticMonitorIdPair.builder()}.
* Use the static factory method to create immutable instances:
* {@code ImmutableAgentRollupIdSyntheticMonitorIdPair.of()}.
*/
@Generated(from = "SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
final class ImmutableAgentRollupIdSyntheticMonitorIdPair
implements SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair {
private final String agentRollupId;
private final String syntheticMonitorId;
private ImmutableAgentRollupIdSyntheticMonitorIdPair(String agentRollupId, String syntheticMonitorId) {
this.agentRollupId = Objects.requireNonNull(agentRollupId, "agentRollupId");
this.syntheticMonitorId = Objects.requireNonNull(syntheticMonitorId, "syntheticMonitorId");
}
private ImmutableAgentRollupIdSyntheticMonitorIdPair(
ImmutableAgentRollupIdSyntheticMonitorIdPair original,
String agentRollupId,
String syntheticMonitorId) {
this.agentRollupId = agentRollupId;
this.syntheticMonitorId = syntheticMonitorId;
}
/**
* @return The value of the {@code agentRollupId} attribute
*/
@JsonProperty("agentRollupId")
@Override
public String agentRollupId() {
return agentRollupId;
}
/**
* @return The value of the {@code syntheticMonitorId} attribute
*/
@JsonProperty("syntheticMonitorId")
@Override
public String syntheticMonitorId() {
return syntheticMonitorId;
}
/**
* Copy the current immutable object by setting a value for the {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#agentRollupId() agentRollupId} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for agentRollupId
* @return A modified copy of the {@code this} object
*/
public final ImmutableAgentRollupIdSyntheticMonitorIdPair withAgentRollupId(String value) {
String newValue = Objects.requireNonNull(value, "agentRollupId");
if (this.agentRollupId.equals(newValue)) return this;
return new ImmutableAgentRollupIdSyntheticMonitorIdPair(this, newValue, this.syntheticMonitorId);
}
/**
* Copy the current immutable object by setting a value for the {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#syntheticMonitorId() syntheticMonitorId} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for syntheticMonitorId
* @return A modified copy of the {@code this} object
*/
public final ImmutableAgentRollupIdSyntheticMonitorIdPair withSyntheticMonitorId(String value) {
String newValue = Objects.requireNonNull(value, "syntheticMonitorId");
if (this.syntheticMonitorId.equals(newValue)) return this;
return new ImmutableAgentRollupIdSyntheticMonitorIdPair(this, this.agentRollupId, newValue);
}
/**
* This instance is equal to all instances of {@code ImmutableAgentRollupIdSyntheticMonitorIdPair} 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 ImmutableAgentRollupIdSyntheticMonitorIdPair
&& equalTo((ImmutableAgentRollupIdSyntheticMonitorIdPair) another);
}
private boolean equalTo(ImmutableAgentRollupIdSyntheticMonitorIdPair another) {
return agentRollupId.equals(another.agentRollupId)
&& syntheticMonitorId.equals(another.syntheticMonitorId);
}
/**
* Computes a hash code from attributes: {@code agentRollupId}, {@code syntheticMonitorId}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + agentRollupId.hashCode();
h += (h << 5) + syntheticMonitorId.hashCode();
return h;
}
/**
* Prints the immutable value {@code AgentRollupIdSyntheticMonitorIdPair} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("AgentRollupIdSyntheticMonitorIdPair")
.omitNullValues()
.add("agentRollupId", agentRollupId)
.add("syntheticMonitorId", syntheticMonitorId)
.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 = "SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair", generator = "Immutables")
@Deprecated
@SuppressWarnings("Immutable")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json
implements SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair {
@Nullable String agentRollupId;
@Nullable String syntheticMonitorId;
@JsonProperty("agentRollupId")
public void setAgentRollupId(String agentRollupId) {
this.agentRollupId = agentRollupId;
}
@JsonProperty("syntheticMonitorId")
public void setSyntheticMonitorId(String syntheticMonitorId) {
this.syntheticMonitorId = syntheticMonitorId;
}
@Override
public String agentRollupId() { throw new UnsupportedOperationException(); }
@Override
public String syntheticMonitorId() { 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 ImmutableAgentRollupIdSyntheticMonitorIdPair fromJson(Json json) {
ImmutableAgentRollupIdSyntheticMonitorIdPair.Builder builder = ImmutableAgentRollupIdSyntheticMonitorIdPair.builder();
if (json.agentRollupId != null) {
builder.agentRollupId(json.agentRollupId);
}
if (json.syntheticMonitorId != null) {
builder.syntheticMonitorId(json.syntheticMonitorId);
}
return builder.build();
}
/**
* Construct a new immutable {@code AgentRollupIdSyntheticMonitorIdPair} instance.
* @param agentRollupId The value for the {@code agentRollupId} attribute
* @param syntheticMonitorId The value for the {@code syntheticMonitorId} attribute
* @return An immutable AgentRollupIdSyntheticMonitorIdPair instance
*/
public static ImmutableAgentRollupIdSyntheticMonitorIdPair of(String agentRollupId, String syntheticMonitorId) {
return new ImmutableAgentRollupIdSyntheticMonitorIdPair(agentRollupId, syntheticMonitorId);
}
/**
* Creates an immutable copy of a {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair} 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 AgentRollupIdSyntheticMonitorIdPair instance
*/
public static ImmutableAgentRollupIdSyntheticMonitorIdPair copyOf(SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair instance) {
if (instance instanceof ImmutableAgentRollupIdSyntheticMonitorIdPair) {
return (ImmutableAgentRollupIdSyntheticMonitorIdPair) instance;
}
return ImmutableAgentRollupIdSyntheticMonitorIdPair.builder()
.copyFrom(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableAgentRollupIdSyntheticMonitorIdPair ImmutableAgentRollupIdSyntheticMonitorIdPair}.
*
* ImmutableAgentRollupIdSyntheticMonitorIdPair.builder()
* .agentRollupId(String) // required {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#agentRollupId() agentRollupId}
* .syntheticMonitorId(String) // required {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#syntheticMonitorId() syntheticMonitorId}
* .build();
*
* @return A new ImmutableAgentRollupIdSyntheticMonitorIdPair builder
*/
public static ImmutableAgentRollupIdSyntheticMonitorIdPair.Builder builder() {
return new ImmutableAgentRollupIdSyntheticMonitorIdPair.Builder();
}
/**
* Builds instances of type {@link ImmutableAgentRollupIdSyntheticMonitorIdPair ImmutableAgentRollupIdSyntheticMonitorIdPair}.
* 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 = "SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private static final long INIT_BIT_AGENT_ROLLUP_ID = 0x1L;
private static final long INIT_BIT_SYNTHETIC_MONITOR_ID = 0x2L;
private long initBits = 0x3L;
private @Nullable String agentRollupId;
private @Nullable String syntheticMonitorId;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code AgentRollupIdSyntheticMonitorIdPair} 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(SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair instance) {
Objects.requireNonNull(instance, "instance");
agentRollupId(instance.agentRollupId());
syntheticMonitorId(instance.syntheticMonitorId());
return this;
}
/**
* Initializes the value for the {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#agentRollupId() agentRollupId} attribute.
* @param agentRollupId The value for agentRollupId
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder agentRollupId(String agentRollupId) {
this.agentRollupId = Objects.requireNonNull(agentRollupId, "agentRollupId");
initBits &= ~INIT_BIT_AGENT_ROLLUP_ID;
return this;
}
/**
* Initializes the value for the {@link SchemaUpgrade.AgentRollupIdSyntheticMonitorIdPair#syntheticMonitorId() syntheticMonitorId} attribute.
* @param syntheticMonitorId The value for syntheticMonitorId
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder syntheticMonitorId(String syntheticMonitorId) {
this.syntheticMonitorId = Objects.requireNonNull(syntheticMonitorId, "syntheticMonitorId");
initBits &= ~INIT_BIT_SYNTHETIC_MONITOR_ID;
return this;
}
/**
* Builds a new {@link ImmutableAgentRollupIdSyntheticMonitorIdPair ImmutableAgentRollupIdSyntheticMonitorIdPair}.
* @return An immutable instance of AgentRollupIdSyntheticMonitorIdPair
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableAgentRollupIdSyntheticMonitorIdPair build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableAgentRollupIdSyntheticMonitorIdPair(null, agentRollupId, syntheticMonitorId);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_AGENT_ROLLUP_ID) != 0) attributes.add("agentRollupId");
if ((initBits & INIT_BIT_SYNTHETIC_MONITOR_ID) != 0) attributes.add("syntheticMonitorId");
return "Cannot build AgentRollupIdSyntheticMonitorIdPair, some of required attributes are not set " + attributes;
}
}
}