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

org.glowroot.central.repo.ImmutableSyntheticResultRollup0 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.common.primitives.Booleans;
import com.google.common.primitives.Doubles;
import com.google.common.primitives.Longs;
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 SyntheticResultDao.SyntheticResultRollup0}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableSyntheticResultRollup0.builder()}. */ @Generated(from = "SyntheticResultDao.SyntheticResultRollup0", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableSyntheticResultRollup0 implements SyntheticResultDao.SyntheticResultRollup0 { private final long captureTime; private final double totalDurationNanos; private final boolean error; private ImmutableSyntheticResultRollup0(long captureTime, double totalDurationNanos, boolean error) { this.captureTime = captureTime; this.totalDurationNanos = totalDurationNanos; this.error = error; } /** * @return The value of the {@code captureTime} attribute */ @JsonProperty("captureTime") @Override public long captureTime() { return captureTime; } /** * @return The value of the {@code totalDurationNanos} attribute */ @JsonProperty("totalDurationNanos") @Override public double totalDurationNanos() { return totalDurationNanos; } /** * @return The value of the {@code error} attribute */ @JsonProperty("error") @Override public boolean error() { return error; } /** * Copy the current immutable object by setting a value for the {@link SyntheticResultDao.SyntheticResultRollup0#captureTime() captureTime} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for captureTime * @return A modified copy of the {@code this} object */ public final ImmutableSyntheticResultRollup0 withCaptureTime(long value) { if (this.captureTime == value) return this; return new ImmutableSyntheticResultRollup0(value, this.totalDurationNanos, this.error); } /** * Copy the current immutable object by setting a value for the {@link SyntheticResultDao.SyntheticResultRollup0#totalDurationNanos() totalDurationNanos} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for totalDurationNanos * @return A modified copy of the {@code this} object */ public final ImmutableSyntheticResultRollup0 withTotalDurationNanos(double value) { if (Double.doubleToLongBits(this.totalDurationNanos) == Double.doubleToLongBits(value)) return this; return new ImmutableSyntheticResultRollup0(this.captureTime, value, this.error); } /** * Copy the current immutable object by setting a value for the {@link SyntheticResultDao.SyntheticResultRollup0#error() error} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for error * @return A modified copy of the {@code this} object */ public final ImmutableSyntheticResultRollup0 withError(boolean value) { if (this.error == value) return this; return new ImmutableSyntheticResultRollup0(this.captureTime, this.totalDurationNanos, value); } /** * This instance is equal to all instances of {@code ImmutableSyntheticResultRollup0} 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 ImmutableSyntheticResultRollup0 && equalTo((ImmutableSyntheticResultRollup0) another); } private boolean equalTo(ImmutableSyntheticResultRollup0 another) { return captureTime == another.captureTime && Double.doubleToLongBits(totalDurationNanos) == Double.doubleToLongBits(another.totalDurationNanos) && error == another.error; } /** * Computes a hash code from attributes: {@code captureTime}, {@code totalDurationNanos}, {@code error}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + Longs.hashCode(captureTime); h += (h << 5) + Doubles.hashCode(totalDurationNanos); h += (h << 5) + Booleans.hashCode(error); return h; } /** * Prints the immutable value {@code SyntheticResultRollup0} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("SyntheticResultRollup0") .omitNullValues() .add("captureTime", captureTime) .add("totalDurationNanos", totalDurationNanos) .add("error", error) .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 = "SyntheticResultDao.SyntheticResultRollup0", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements SyntheticResultDao.SyntheticResultRollup0 { long captureTime; boolean captureTimeIsSet; double totalDurationNanos; boolean totalDurationNanosIsSet; boolean error; boolean errorIsSet; @JsonProperty("captureTime") public void setCaptureTime(long captureTime) { this.captureTime = captureTime; this.captureTimeIsSet = true; } @JsonProperty("totalDurationNanos") public void setTotalDurationNanos(double totalDurationNanos) { this.totalDurationNanos = totalDurationNanos; this.totalDurationNanosIsSet = true; } @JsonProperty("error") public void setError(boolean error) { this.error = error; this.errorIsSet = true; } @Override public long captureTime() { throw new UnsupportedOperationException(); } @Override public double totalDurationNanos() { throw new UnsupportedOperationException(); } @Override public boolean error() { 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 ImmutableSyntheticResultRollup0 fromJson(Json json) { ImmutableSyntheticResultRollup0.Builder builder = ImmutableSyntheticResultRollup0.builder(); if (json.captureTimeIsSet) { builder.captureTime(json.captureTime); } if (json.totalDurationNanosIsSet) { builder.totalDurationNanos(json.totalDurationNanos); } if (json.errorIsSet) { builder.error(json.error); } return builder.build(); } /** * Creates an immutable copy of a {@link SyntheticResultDao.SyntheticResultRollup0} 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 SyntheticResultRollup0 instance */ public static ImmutableSyntheticResultRollup0 copyOf(SyntheticResultDao.SyntheticResultRollup0 instance) { if (instance instanceof ImmutableSyntheticResultRollup0) { return (ImmutableSyntheticResultRollup0) instance; } return ImmutableSyntheticResultRollup0.builder() .copyFrom(instance) .build(); } /** * Creates a builder for {@link ImmutableSyntheticResultRollup0 ImmutableSyntheticResultRollup0}. *

   * ImmutableSyntheticResultRollup0.builder()
   *    .captureTime(long) // required {@link SyntheticResultDao.SyntheticResultRollup0#captureTime() captureTime}
   *    .totalDurationNanos(double) // required {@link SyntheticResultDao.SyntheticResultRollup0#totalDurationNanos() totalDurationNanos}
   *    .error(boolean) // required {@link SyntheticResultDao.SyntheticResultRollup0#error() error}
   *    .build();
   * 
* @return A new ImmutableSyntheticResultRollup0 builder */ public static ImmutableSyntheticResultRollup0.Builder builder() { return new ImmutableSyntheticResultRollup0.Builder(); } /** * Builds instances of type {@link ImmutableSyntheticResultRollup0 ImmutableSyntheticResultRollup0}. * 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 = "SyntheticResultDao.SyntheticResultRollup0", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_CAPTURE_TIME = 0x1L; private static final long INIT_BIT_TOTAL_DURATION_NANOS = 0x2L; private static final long INIT_BIT_ERROR = 0x4L; private long initBits = 0x7L; private long captureTime; private double totalDurationNanos; private boolean error; private Builder() { } /** * Fill a builder with attribute values from the provided {@code SyntheticResultRollup0} 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(SyntheticResultDao.SyntheticResultRollup0 instance) { Objects.requireNonNull(instance, "instance"); captureTime(instance.captureTime()); totalDurationNanos(instance.totalDurationNanos()); error(instance.error()); return this; } /** * Initializes the value for the {@link SyntheticResultDao.SyntheticResultRollup0#captureTime() captureTime} attribute. * @param captureTime The value for captureTime * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder captureTime(long captureTime) { this.captureTime = captureTime; initBits &= ~INIT_BIT_CAPTURE_TIME; return this; } /** * Initializes the value for the {@link SyntheticResultDao.SyntheticResultRollup0#totalDurationNanos() totalDurationNanos} attribute. * @param totalDurationNanos The value for totalDurationNanos * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder totalDurationNanos(double totalDurationNanos) { this.totalDurationNanos = totalDurationNanos; initBits &= ~INIT_BIT_TOTAL_DURATION_NANOS; return this; } /** * Initializes the value for the {@link SyntheticResultDao.SyntheticResultRollup0#error() error} attribute. * @param error The value for error * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder error(boolean error) { this.error = error; initBits &= ~INIT_BIT_ERROR; return this; } /** * Builds a new {@link ImmutableSyntheticResultRollup0 ImmutableSyntheticResultRollup0}. * @return An immutable instance of SyntheticResultRollup0 * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSyntheticResultRollup0 build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableSyntheticResultRollup0(captureTime, totalDurationNanos, error); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_CAPTURE_TIME) != 0) attributes.add("captureTime"); if ((initBits & INIT_BIT_TOTAL_DURATION_NANOS) != 0) attributes.add("totalDurationNanos"); if ((initBits & INIT_BIT_ERROR) != 0) attributes.add("error"); return "Cannot build SyntheticResultRollup0, some of required attributes are not set " + attributes; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy