org.glowroot.central.v09support.ImmutableAggregateQueryPlan Maven / Gradle / Ivy
package org.glowroot.central.v09support;
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.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.common.live.LiveAggregateRepository;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link AggregateDaoWithV09Support.AggregateQueryPlan}.
*
* Use the builder to create immutable instances:
* {@code ImmutableAggregateQueryPlan.builder()}.
*/
@Generated(from = "AggregateDaoWithV09Support.AggregateQueryPlan", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
final class ImmutableAggregateQueryPlan
implements AggregateDaoWithV09Support.AggregateQueryPlan {
private final LiveAggregateRepository.@Nullable AggregateQuery queryV09;
private final LiveAggregateRepository.@Nullable AggregateQuery queryPostV09;
private ImmutableAggregateQueryPlan(
LiveAggregateRepository.@Nullable AggregateQuery queryV09,
LiveAggregateRepository.@Nullable AggregateQuery queryPostV09) {
this.queryV09 = queryV09;
this.queryPostV09 = queryPostV09;
}
/**
* @return The value of the {@code queryV09} attribute
*/
@JsonProperty("queryV09")
@Override
public LiveAggregateRepository.@Nullable AggregateQuery queryV09() {
return queryV09;
}
/**
* @return The value of the {@code queryPostV09} attribute
*/
@JsonProperty("queryPostV09")
@Override
public LiveAggregateRepository.@Nullable AggregateQuery queryPostV09() {
return queryPostV09;
}
/**
* Copy the current immutable object by setting a value for the {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryV09() queryV09} 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 queryV09 (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableAggregateQueryPlan withQueryV09(LiveAggregateRepository.@Nullable AggregateQuery value) {
if (this.queryV09 == value) return this;
return new ImmutableAggregateQueryPlan(value, this.queryPostV09);
}
/**
* Copy the current immutable object by setting a value for the {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryPostV09() queryPostV09} 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 queryPostV09 (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableAggregateQueryPlan withQueryPostV09(LiveAggregateRepository.@Nullable AggregateQuery value) {
if (this.queryPostV09 == value) return this;
return new ImmutableAggregateQueryPlan(this.queryV09, value);
}
/**
* This instance is equal to all instances of {@code ImmutableAggregateQueryPlan} 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 ImmutableAggregateQueryPlan
&& equalTo((ImmutableAggregateQueryPlan) another);
}
private boolean equalTo(ImmutableAggregateQueryPlan another) {
return Objects.equals(queryV09, another.queryV09)
&& Objects.equals(queryPostV09, another.queryPostV09);
}
/**
* Computes a hash code from attributes: {@code queryV09}, {@code queryPostV09}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + Objects.hashCode(queryV09);
h += (h << 5) + Objects.hashCode(queryPostV09);
return h;
}
/**
* Prints the immutable value {@code AggregateQueryPlan} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("AggregateQueryPlan")
.omitNullValues()
.add("queryV09", queryV09)
.add("queryPostV09", queryPostV09)
.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 = "AggregateDaoWithV09Support.AggregateQueryPlan", generator = "Immutables")
@Deprecated
@SuppressWarnings("Immutable")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json
implements AggregateDaoWithV09Support.AggregateQueryPlan {
@javax.annotation.Nullable LiveAggregateRepository.@Nullable AggregateQuery queryV09;
@javax.annotation.Nullable LiveAggregateRepository.@Nullable AggregateQuery queryPostV09;
@JsonProperty("queryV09")
public void setQueryV09(LiveAggregateRepository.@Nullable AggregateQuery queryV09) {
this.queryV09 = queryV09;
}
@JsonProperty("queryPostV09")
public void setQueryPostV09(LiveAggregateRepository.@Nullable AggregateQuery queryPostV09) {
this.queryPostV09 = queryPostV09;
}
@Override
public LiveAggregateRepository.@Nullable AggregateQuery queryV09() { throw new UnsupportedOperationException(); }
@Override
public LiveAggregateRepository.@Nullable AggregateQuery queryPostV09() { 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 ImmutableAggregateQueryPlan fromJson(Json json) {
ImmutableAggregateQueryPlan.Builder builder = ImmutableAggregateQueryPlan.builder();
if (json.queryV09 != null) {
builder.queryV09(json.queryV09);
}
if (json.queryPostV09 != null) {
builder.queryPostV09(json.queryPostV09);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link AggregateDaoWithV09Support.AggregateQueryPlan} 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 AggregateQueryPlan instance
*/
public static ImmutableAggregateQueryPlan copyOf(AggregateDaoWithV09Support.AggregateQueryPlan instance) {
if (instance instanceof ImmutableAggregateQueryPlan) {
return (ImmutableAggregateQueryPlan) instance;
}
return ImmutableAggregateQueryPlan.builder()
.copyFrom(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableAggregateQueryPlan ImmutableAggregateQueryPlan}.
*
* ImmutableAggregateQueryPlan.builder()
* .queryV09(org.glowroot.common.live.LiveAggregateRepository.@org.checkerframework.checker.nullness.qual.Nullable AggregateQuery | null) // nullable {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryV09() queryV09}
* .queryPostV09(org.glowroot.common.live.LiveAggregateRepository.@org.checkerframework.checker.nullness.qual.Nullable AggregateQuery | null) // nullable {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryPostV09() queryPostV09}
* .build();
*
* @return A new ImmutableAggregateQueryPlan builder
*/
public static ImmutableAggregateQueryPlan.Builder builder() {
return new ImmutableAggregateQueryPlan.Builder();
}
/**
* Builds instances of type {@link ImmutableAggregateQueryPlan ImmutableAggregateQueryPlan}.
* 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 = "AggregateDaoWithV09Support.AggregateQueryPlan", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private @javax.annotation.Nullable LiveAggregateRepository.@Nullable AggregateQuery queryV09;
private @javax.annotation.Nullable LiveAggregateRepository.@Nullable AggregateQuery queryPostV09;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code AggregateQueryPlan} 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(AggregateDaoWithV09Support.AggregateQueryPlan instance) {
Objects.requireNonNull(instance, "instance");
LiveAggregateRepository.@Nullable AggregateQuery queryV09Value = instance.queryV09();
if (queryV09Value != null) {
queryV09(queryV09Value);
}
LiveAggregateRepository.@Nullable AggregateQuery queryPostV09Value = instance.queryPostV09();
if (queryPostV09Value != null) {
queryPostV09(queryPostV09Value);
}
return this;
}
/**
* Initializes the value for the {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryV09() queryV09} attribute.
* @param queryV09 The value for queryV09 (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder queryV09(LiveAggregateRepository.@Nullable AggregateQuery queryV09) {
this.queryV09 = queryV09;
return this;
}
/**
* Initializes the value for the {@link AggregateDaoWithV09Support.AggregateQueryPlan#queryPostV09() queryPostV09} attribute.
* @param queryPostV09 The value for queryPostV09 (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder queryPostV09(LiveAggregateRepository.@Nullable AggregateQuery queryPostV09) {
this.queryPostV09 = queryPostV09;
return this;
}
/**
* Builds a new {@link ImmutableAggregateQueryPlan ImmutableAggregateQueryPlan}.
* @return An immutable instance of AggregateQueryPlan
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableAggregateQueryPlan build() {
return new ImmutableAggregateQueryPlan(queryV09, queryPostV09);
}
}
}