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

org.glowroot.common.live.ImmutableTracePointQuery Maven / Gradle / Ivy

There is a newer version: 0.9.28
Show newest version
package org.glowroot.common.live;

import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonProperty;
import org.glowroot.agent.shaded.google.common.base.MoreObjects;
import org.glowroot.agent.shaded.google.common.base.Objects;
import org.glowroot.agent.shaded.google.common.base.Preconditions;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.glowroot.agent.shaded.google.common.primitives.Booleans;
import org.glowroot.agent.shaded.google.common.primitives.Longs;
import java.util.ArrayList;
import java.util.List;
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 LiveTraceRepository.TracePointQuery}.
 * 

* Use builder to create immutable instances: * {@code ImmutableTracePointQuery.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "LiveTraceRepository.TracePointQuery"}) @Immutable public final class ImmutableTracePointQuery extends LiveTraceRepository.TracePointQuery { private final String serverRollup; private final long from; private final long to; private final long durationNanosLow; private final @Nullable Long durationNanosHigh; private final @Nullable String transactionType; private final @Nullable StringComparator transactionNameComparator; private final @Nullable String transactionName; private final @Nullable StringComparator headlineComparator; private final @Nullable String headline; private final @Nullable StringComparator errorComparator; private final @Nullable String error; private final @Nullable StringComparator userComparator; private final @Nullable String user; private final @Nullable String attributeName; private final @Nullable StringComparator attributeValueComparator; private final @Nullable String attributeValue; private final boolean slowOnly; private final boolean errorOnly; private final int limit; private ImmutableTracePointQuery(ImmutableTracePointQuery.Builder builder) { this.serverRollup = builder.serverRollup; this.from = builder.from; this.to = builder.to; this.durationNanosLow = builder.durationNanosLow; this.durationNanosHigh = builder.durationNanosHigh; this.transactionType = builder.transactionType; this.transactionNameComparator = builder.transactionNameComparator; this.transactionName = builder.transactionName; this.headlineComparator = builder.headlineComparator; this.headline = builder.headline; this.errorComparator = builder.errorComparator; this.error = builder.error; this.userComparator = builder.userComparator; this.user = builder.user; this.attributeName = builder.attributeName; this.attributeValueComparator = builder.attributeValueComparator; this.attributeValue = builder.attributeValue; this.limit = builder.limit; if (builder.slowOnlyIsSet()) { initShim.slowOnly(builder.slowOnly); } if (builder.errorOnlyIsSet()) { initShim.errorOnly(builder.errorOnly); } this.slowOnly = initShim.slowOnly(); this.errorOnly = initShim.errorOnly(); this.initShim = null; } private static final int STAGE_INITIALIZING = -1; private static final int STAGE_UNINITIALIZED = 0; private static final int STAGE_INITIALIZED = 1; private volatile InitShim initShim = new InitShim(); private final class InitShim { private boolean slowOnly; private byte slowOnlyStage; boolean slowOnly() { if (slowOnlyStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (slowOnlyStage == STAGE_UNINITIALIZED) { slowOnlyStage = STAGE_INITIALIZING; this.slowOnly = ImmutableTracePointQuery.super.slowOnly(); slowOnlyStage = STAGE_INITIALIZED; } return slowOnly; } boolean slowOnly(boolean value) { this.slowOnly = value; slowOnlyStage = STAGE_INITIALIZED; return value; } private boolean errorOnly; private byte errorOnlyStage; boolean errorOnly() { if (errorOnlyStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (errorOnlyStage == STAGE_UNINITIALIZED) { errorOnlyStage = STAGE_INITIALIZING; this.errorOnly = ImmutableTracePointQuery.super.errorOnly(); errorOnlyStage = STAGE_INITIALIZED; } return errorOnly; } boolean errorOnly(boolean value) { this.errorOnly = value; errorOnlyStage = STAGE_INITIALIZED; return value; } private String formatInitCycleMessage() { ArrayList attributes = Lists.newArrayList();; if (slowOnlyStage == STAGE_INITIALIZING) attributes.add("slowOnly"); if (errorOnlyStage == STAGE_INITIALIZING) attributes.add("errorOnly"); return "Cannot build TracePointQuery, attribute initializers form cycle" + attributes; } } private ImmutableTracePointQuery( String serverRollup, long from, long to, long durationNanosLow, @Nullable Long durationNanosHigh, @Nullable String transactionType, @Nullable StringComparator transactionNameComparator, @Nullable String transactionName, @Nullable StringComparator headlineComparator, @Nullable String headline, @Nullable StringComparator errorComparator, @Nullable String error, @Nullable StringComparator userComparator, @Nullable String user, @Nullable String attributeName, @Nullable StringComparator attributeValueComparator, @Nullable String attributeValue, boolean slowOnly, boolean errorOnly, int limit) { this.serverRollup = serverRollup; this.from = from; this.to = to; this.durationNanosLow = durationNanosLow; this.durationNanosHigh = durationNanosHigh; this.transactionType = transactionType; this.transactionNameComparator = transactionNameComparator; this.transactionName = transactionName; this.headlineComparator = headlineComparator; this.headline = headline; this.errorComparator = errorComparator; this.error = error; this.userComparator = userComparator; this.user = user; this.attributeName = attributeName; this.attributeValueComparator = attributeValueComparator; this.attributeValue = attributeValue; this.slowOnly = slowOnly; this.errorOnly = errorOnly; this.limit = limit; this.initShim = null; } /** * @return value of {@code serverRollup} attribute */ @JsonProperty @Override public String serverRollup() { return serverRollup; } /** * @return value of {@code from} attribute */ @JsonProperty @Override public long from() { return from; } /** * @return value of {@code to} attribute */ @JsonProperty @Override public long to() { return to; } /** * @return value of {@code durationNanosLow} attribute */ @JsonProperty @Override public long durationNanosLow() { return durationNanosLow; } /** * @return value of {@code durationNanosHigh} attribute */ @JsonProperty @Override public @Nullable Long durationNanosHigh() { return durationNanosHigh; } /** * @return value of {@code transactionType} attribute */ @JsonProperty @Override public @Nullable String transactionType() { return transactionType; } /** * @return value of {@code transactionNameComparator} attribute */ @JsonProperty @Override public @Nullable StringComparator transactionNameComparator() { return transactionNameComparator; } /** * @return value of {@code transactionName} attribute */ @JsonProperty @Override public @Nullable String transactionName() { return transactionName; } /** * @return value of {@code headlineComparator} attribute */ @JsonProperty @Override public @Nullable StringComparator headlineComparator() { return headlineComparator; } /** * @return value of {@code headline} attribute */ @JsonProperty @Override public @Nullable String headline() { return headline; } /** * @return value of {@code errorComparator} attribute */ @JsonProperty @Override public @Nullable StringComparator errorComparator() { return errorComparator; } /** * @return value of {@code error} attribute */ @JsonProperty @Override public @Nullable String error() { return error; } /** * @return value of {@code userComparator} attribute */ @JsonProperty @Override public @Nullable StringComparator userComparator() { return userComparator; } /** * @return value of {@code user} attribute */ @JsonProperty @Override public @Nullable String user() { return user; } /** * @return value of {@code attributeName} attribute */ @JsonProperty @Override public @Nullable String attributeName() { return attributeName; } /** * @return value of {@code attributeValueComparator} attribute */ @JsonProperty @Override public @Nullable StringComparator attributeValueComparator() { return attributeValueComparator; } /** * @return value of {@code attributeValue} attribute */ @JsonProperty @Override public @Nullable String attributeValue() { return attributeValue; } /** * @return value of {@code slowOnly} attribute */ @JsonProperty @Override public boolean slowOnly() { return initShim != null ? initShim.slowOnly() : slowOnly; } /** * @return value of {@code errorOnly} attribute */ @JsonProperty @Override public boolean errorOnly() { return initShim != null ? initShim.errorOnly() : errorOnly; } /** * @return value of {@code limit} attribute */ @JsonProperty @Override public int limit() { return limit; } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#serverRollup() serverRollup}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for serverRollup * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withServerRollup(String value) { if (this.serverRollup == value) return this; String newValue = Preconditions.checkNotNull(value); return new ImmutableTracePointQuery( newValue, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#from() from}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for from * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withFrom(long value) { if (this.from == value) return this; long newValue = value; return new ImmutableTracePointQuery( this.serverRollup, newValue, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#to() to}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for to * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withTo(long value) { if (this.to == value) return this; long newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, newValue, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#durationNanosLow() durationNanosLow}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for durationNanosLow * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withDurationNanosLow(long value) { if (this.durationNanosLow == value) return this; long newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, newValue, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#durationNanosHigh() durationNanosHigh}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for durationNanosHigh, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withDurationNanosHigh(@Nullable Long value) { if (this.durationNanosHigh == value) return this; @Nullable Long newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, newValue, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#transactionType() transactionType}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for transactionType, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withTransactionType(@Nullable String value) { if (this.transactionType == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, newValue, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#transactionNameComparator() transactionNameComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for transactionNameComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withTransactionNameComparator(@Nullable StringComparator value) { if (this.transactionNameComparator == value) return this; @Nullable StringComparator newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, newValue, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#transactionName() transactionName}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for transactionName, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withTransactionName(@Nullable String value) { if (this.transactionName == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, newValue, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#headlineComparator() headlineComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for headlineComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withHeadlineComparator(@Nullable StringComparator value) { if (this.headlineComparator == value) return this; @Nullable StringComparator newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, newValue, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#headline() headline}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for headline, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withHeadline(@Nullable String value) { if (this.headline == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, newValue, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#errorComparator() errorComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for errorComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withErrorComparator(@Nullable StringComparator value) { if (this.errorComparator == value) return this; @Nullable StringComparator newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, newValue, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#error() error}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for error, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withError(@Nullable String value) { if (this.error == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, newValue, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#userComparator() userComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for userComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withUserComparator(@Nullable StringComparator value) { if (this.userComparator == value) return this; @Nullable StringComparator newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, newValue, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#user() user}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for user, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withUser(@Nullable String value) { if (this.user == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, newValue, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#attributeName() attributeName}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for attributeName, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withAttributeName(@Nullable String value) { if (this.attributeName == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, newValue, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#attributeValueComparator() attributeValueComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for attributeValueComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withAttributeValueComparator(@Nullable StringComparator value) { if (this.attributeValueComparator == value) return this; @Nullable StringComparator newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, newValue, this.attributeValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#attributeValue() attributeValue}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for attributeValue, can be {@code null} * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withAttributeValue(@Nullable String value) { if (this.attributeValue == value) return this; @Nullable String newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, newValue, this.slowOnly, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#slowOnly() slowOnly}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for slowOnly * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withSlowOnly(boolean value) { if (this.slowOnly == value) return this; boolean newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, newValue, this.errorOnly, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#errorOnly() errorOnly}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for errorOnly * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withErrorOnly(boolean value) { if (this.errorOnly == value) return this; boolean newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, newValue, this.limit); } /** * Copy current immutable object by setting value for {@link LiveTraceRepository.TracePointQuery#limit() limit}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for limit * @return modified copy of the {@code this} object */ public final ImmutableTracePointQuery withLimit(int value) { if (this.limit == value) return this; int newValue = value; return new ImmutableTracePointQuery( this.serverRollup, this.from, this.to, this.durationNanosLow, this.durationNanosHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.attributeName, this.attributeValueComparator, this.attributeValue, this.slowOnly, this.errorOnly, newValue); } /** * This instance is equal to instances of {@code ImmutableTracePointQuery} with 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 ImmutableTracePointQuery && equalTo((ImmutableTracePointQuery) another); } private boolean equalTo(ImmutableTracePointQuery another) { return serverRollup.equals(another.serverRollup) && from == another.from && to == another.to && durationNanosLow == another.durationNanosLow && Objects.equal(durationNanosHigh, another.durationNanosHigh) && Objects.equal(transactionType, another.transactionType) && Objects.equal(transactionNameComparator, another.transactionNameComparator) && Objects.equal(transactionName, another.transactionName) && Objects.equal(headlineComparator, another.headlineComparator) && Objects.equal(headline, another.headline) && Objects.equal(errorComparator, another.errorComparator) && Objects.equal(error, another.error) && Objects.equal(userComparator, another.userComparator) && Objects.equal(user, another.user) && Objects.equal(attributeName, another.attributeName) && Objects.equal(attributeValueComparator, another.attributeValueComparator) && Objects.equal(attributeValue, another.attributeValue) && slowOnly == another.slowOnly && errorOnly == another.errorOnly && limit == another.limit; } /** * Computes hash code from attributes: {@code serverRollup}, {@code from}, {@code to}, {@code durationNanosLow}, {@code durationNanosHigh}, {@code transactionType}, {@code transactionNameComparator}, {@code transactionName}, {@code headlineComparator}, {@code headline}, {@code errorComparator}, {@code error}, {@code userComparator}, {@code user}, {@code attributeName}, {@code attributeValueComparator}, {@code attributeValue}, {@code slowOnly}, {@code errorOnly}, {@code limit}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + serverRollup.hashCode(); h = h * 17 + Longs.hashCode(from); h = h * 17 + Longs.hashCode(to); h = h * 17 + Longs.hashCode(durationNanosLow); h = h * 17 + Objects.hashCode(durationNanosHigh); h = h * 17 + Objects.hashCode(transactionType); h = h * 17 + Objects.hashCode(transactionNameComparator); h = h * 17 + Objects.hashCode(transactionName); h = h * 17 + Objects.hashCode(headlineComparator); h = h * 17 + Objects.hashCode(headline); h = h * 17 + Objects.hashCode(errorComparator); h = h * 17 + Objects.hashCode(error); h = h * 17 + Objects.hashCode(userComparator); h = h * 17 + Objects.hashCode(user); h = h * 17 + Objects.hashCode(attributeName); h = h * 17 + Objects.hashCode(attributeValueComparator); h = h * 17 + Objects.hashCode(attributeValue); h = h * 17 + Booleans.hashCode(slowOnly); h = h * 17 + Booleans.hashCode(errorOnly); h = h * 17 + limit; return h; } /** * Prints immutable value {@code TracePointQuery...} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("TracePointQuery") .add("serverRollup", serverRollup) .add("from", from) .add("to", to) .add("durationNanosLow", durationNanosLow) .add("durationNanosHigh", durationNanosHigh) .add("transactionType", transactionType) .add("transactionNameComparator", transactionNameComparator) .add("transactionName", transactionName) .add("headlineComparator", headlineComparator) .add("headline", headline) .add("errorComparator", errorComparator) .add("error", error) .add("userComparator", userComparator) .add("user", user) .add("attributeName", attributeName) .add("attributeValueComparator", attributeValueComparator) .add("attributeValue", attributeValue) .add("slowOnly", slowOnly) .add("errorOnly", errorOnly) .add("limit", limit) .toString(); } /** * Simple representation of this value type suitable Jackson binding * @deprecated Do not use this type directly, it exists only for Jackson-binding infrastructure */ @Deprecated static final class Json { @JsonProperty @Nullable String serverRollup; @JsonProperty @Nullable Long from; @JsonProperty @Nullable Long to; @JsonProperty @Nullable Long durationNanosLow; @JsonProperty @Nullable Long durationNanosHigh; @JsonProperty @Nullable String transactionType; @JsonProperty @Nullable StringComparator transactionNameComparator; @JsonProperty @Nullable String transactionName; @JsonProperty @Nullable StringComparator headlineComparator; @JsonProperty @Nullable String headline; @JsonProperty @Nullable StringComparator errorComparator; @JsonProperty @Nullable String error; @JsonProperty @Nullable StringComparator userComparator; @JsonProperty @Nullable String user; @JsonProperty @Nullable String attributeName; @JsonProperty @Nullable StringComparator attributeValueComparator; @JsonProperty @Nullable String attributeValue; @JsonProperty @Nullable Boolean slowOnly; @JsonProperty @Nullable Boolean errorOnly; @JsonProperty @Nullable Integer limit; } /** * @param json JSON-bindable data structure * @return immutable value type * @deprecated Do not use this method directly, it exists only for Jackson-binding infrastructure */ @Deprecated @JsonCreator static ImmutableTracePointQuery fromJson(Json json) { ImmutableTracePointQuery.Builder builder = ImmutableTracePointQuery.builder(); if (json.serverRollup != null) { builder.serverRollup(json.serverRollup); } if (json.from != null) { builder.from(json.from); } if (json.to != null) { builder.to(json.to); } if (json.durationNanosLow != null) { builder.durationNanosLow(json.durationNanosLow); } if (json.durationNanosHigh != null) { builder.durationNanosHigh(json.durationNanosHigh); } if (json.transactionType != null) { builder.transactionType(json.transactionType); } if (json.transactionNameComparator != null) { builder.transactionNameComparator(json.transactionNameComparator); } if (json.transactionName != null) { builder.transactionName(json.transactionName); } if (json.headlineComparator != null) { builder.headlineComparator(json.headlineComparator); } if (json.headline != null) { builder.headline(json.headline); } if (json.errorComparator != null) { builder.errorComparator(json.errorComparator); } if (json.error != null) { builder.error(json.error); } if (json.userComparator != null) { builder.userComparator(json.userComparator); } if (json.user != null) { builder.user(json.user); } if (json.attributeName != null) { builder.attributeName(json.attributeName); } if (json.attributeValueComparator != null) { builder.attributeValueComparator(json.attributeValueComparator); } if (json.attributeValue != null) { builder.attributeValue(json.attributeValue); } if (json.slowOnly != null) { builder.slowOnly(json.slowOnly); } if (json.errorOnly != null) { builder.errorOnly(json.errorOnly); } if (json.limit != null) { builder.limit(json.limit); } return builder.build(); } /** * Creates immutable copy of {@link LiveTraceRepository.TracePointQuery}. * Uses accessors to get values to initialize immutable instance. * If an instance is already immutable, it is returned as is. * @param instance instance to copy * @return copied immutable TracePointQuery instance */ public static ImmutableTracePointQuery copyOf(LiveTraceRepository.TracePointQuery instance) { if (instance instanceof ImmutableTracePointQuery) { return (ImmutableTracePointQuery) instance; } return ImmutableTracePointQuery.builder() .copyFrom(instance) .build(); } /** * Creates builder for {@link org.glowroot.common.live.ImmutableTracePointQuery ImmutableTracePointQuery}. * @return new ImmutableTracePointQuery builder */ public static ImmutableTracePointQuery.Builder builder() { return new ImmutableTracePointQuery.Builder(); } /** * Builds instances of {@link org.glowroot.common.live.ImmutableTracePointQuery ImmutableTracePointQuery}. * Initialize attributes and then invoke {@link #build()} method to create * immutable instance. *

{@code Builder} is not thread safe and generally should not be stored in field or collection, * but used immediately to create instances. */ @NotThreadSafe public static final class Builder { private static final long INIT_BIT_SERVER_ROLLUP = 0x1L; private static final long INIT_BIT_FROM = 0x2L; private static final long INIT_BIT_TO = 0x4L; private static final long INIT_BIT_DURATION_NANOS_LOW = 0x8L; private static final long INIT_BIT_LIMIT = 0x10L; private static final long OPT_BIT_SLOW_ONLY = 0x1L; private static final long OPT_BIT_ERROR_ONLY = 0x2L; private long initBits = 0x1f; private long optBits; private @Nullable String serverRollup; private long from; private long to; private long durationNanosLow; private @Nullable Long durationNanosHigh; private @Nullable String transactionType; private @Nullable StringComparator transactionNameComparator; private @Nullable String transactionName; private @Nullable StringComparator headlineComparator; private @Nullable String headline; private @Nullable StringComparator errorComparator; private @Nullable String error; private @Nullable StringComparator userComparator; private @Nullable String user; private @Nullable String attributeName; private @Nullable StringComparator attributeValueComparator; private @Nullable String attributeValue; private boolean slowOnly; private boolean errorOnly; private int limit; private Builder() {} /** * Fill builder with attribute values from provided {@link LiveTraceRepository.TracePointQuery} instance. * Regular attribute values will be replaced with ones of an instance. * Instance's absent optional values will not replace present values. * @param instance instance to copy values from * @return {@code this} builder for chained invocation */ public final Builder copyFrom(LiveTraceRepository.TracePointQuery instance) { Preconditions.checkNotNull(instance); serverRollup(instance.serverRollup()); from(instance.from()); to(instance.to()); durationNanosLow(instance.durationNanosLow()); @Nullable Long durationNanosHighValue = instance.durationNanosHigh(); if (durationNanosHighValue != null) { durationNanosHigh(durationNanosHighValue); } @Nullable String transactionTypeValue = instance.transactionType(); if (transactionTypeValue != null) { transactionType(transactionTypeValue); } @Nullable StringComparator transactionNameComparatorValue = instance.transactionNameComparator(); if (transactionNameComparatorValue != null) { transactionNameComparator(transactionNameComparatorValue); } @Nullable String transactionNameValue = instance.transactionName(); if (transactionNameValue != null) { transactionName(transactionNameValue); } @Nullable StringComparator headlineComparatorValue = instance.headlineComparator(); if (headlineComparatorValue != null) { headlineComparator(headlineComparatorValue); } @Nullable String headlineValue = instance.headline(); if (headlineValue != null) { headline(headlineValue); } @Nullable StringComparator errorComparatorValue = instance.errorComparator(); if (errorComparatorValue != null) { errorComparator(errorComparatorValue); } @Nullable String errorValue = instance.error(); if (errorValue != null) { error(errorValue); } @Nullable StringComparator userComparatorValue = instance.userComparator(); if (userComparatorValue != null) { userComparator(userComparatorValue); } @Nullable String userValue = instance.user(); if (userValue != null) { user(userValue); } @Nullable String attributeNameValue = instance.attributeName(); if (attributeNameValue != null) { attributeName(attributeNameValue); } @Nullable StringComparator attributeValueComparatorValue = instance.attributeValueComparator(); if (attributeValueComparatorValue != null) { attributeValueComparator(attributeValueComparatorValue); } @Nullable String attributeValueValue = instance.attributeValue(); if (attributeValueValue != null) { attributeValue(attributeValueValue); } slowOnly(instance.slowOnly()); errorOnly(instance.errorOnly()); limit(instance.limit()); return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#serverRollup() serverRollup}. * @param serverRollup value for serverRollup * @return {@code this} builder for chained invocation */ public final Builder serverRollup(String serverRollup) { this.serverRollup = Preconditions.checkNotNull(serverRollup); initBits &= ~INIT_BIT_SERVER_ROLLUP; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#from() from}. * @param from value for from * @return {@code this} builder for chained invocation */ public final Builder from(long from) { this.from = from; initBits &= ~INIT_BIT_FROM; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#to() to}. * @param to value for to * @return {@code this} builder for chained invocation */ public final Builder to(long to) { this.to = to; initBits &= ~INIT_BIT_TO; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#durationNanosLow() durationNanosLow}. * @param durationNanosLow value for durationNanosLow * @return {@code this} builder for chained invocation */ public final Builder durationNanosLow(long durationNanosLow) { this.durationNanosLow = durationNanosLow; initBits &= ~INIT_BIT_DURATION_NANOS_LOW; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#durationNanosHigh() durationNanosHigh}. * @param durationNanosHigh value for durationNanosHigh, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder durationNanosHigh(@Nullable Long durationNanosHigh) { this.durationNanosHigh = durationNanosHigh; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#transactionType() transactionType}. * @param transactionType value for transactionType, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder transactionType(@Nullable String transactionType) { this.transactionType = transactionType; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#transactionNameComparator() transactionNameComparator}. * @param transactionNameComparator value for transactionNameComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder transactionNameComparator(@Nullable StringComparator transactionNameComparator) { this.transactionNameComparator = transactionNameComparator; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#transactionName() transactionName}. * @param transactionName value for transactionName, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder transactionName(@Nullable String transactionName) { this.transactionName = transactionName; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#headlineComparator() headlineComparator}. * @param headlineComparator value for headlineComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder headlineComparator(@Nullable StringComparator headlineComparator) { this.headlineComparator = headlineComparator; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#headline() headline}. * @param headline value for headline, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder headline(@Nullable String headline) { this.headline = headline; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#errorComparator() errorComparator}. * @param errorComparator value for errorComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder errorComparator(@Nullable StringComparator errorComparator) { this.errorComparator = errorComparator; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#error() error}. * @param error value for error, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder error(@Nullable String error) { this.error = error; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#userComparator() userComparator}. * @param userComparator value for userComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder userComparator(@Nullable StringComparator userComparator) { this.userComparator = userComparator; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#user() user}. * @param user value for user, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder user(@Nullable String user) { this.user = user; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#attributeName() attributeName}. * @param attributeName value for attributeName, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder attributeName(@Nullable String attributeName) { this.attributeName = attributeName; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#attributeValueComparator() attributeValueComparator}. * @param attributeValueComparator value for attributeValueComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder attributeValueComparator(@Nullable StringComparator attributeValueComparator) { this.attributeValueComparator = attributeValueComparator; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#attributeValue() attributeValue}. * @param attributeValue value for attributeValue, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder attributeValue(@Nullable String attributeValue) { this.attributeValue = attributeValue; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#slowOnly() slowOnly}. *

If not set, this attribute will have default value returned by initializer of {@link LiveTraceRepository.TracePointQuery#slowOnly() slowOnly}. * @param slowOnly value for slowOnly * @return {@code this} builder for chained invocation */ public final Builder slowOnly(boolean slowOnly) { this.slowOnly = slowOnly; optBits |= OPT_BIT_SLOW_ONLY; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#errorOnly() errorOnly}. *

If not set, this attribute will have default value returned by initializer of {@link LiveTraceRepository.TracePointQuery#errorOnly() errorOnly}. * @param errorOnly value for errorOnly * @return {@code this} builder for chained invocation */ public final Builder errorOnly(boolean errorOnly) { this.errorOnly = errorOnly; optBits |= OPT_BIT_ERROR_ONLY; return this; } /** * Initializes value for {@link LiveTraceRepository.TracePointQuery#limit() limit}. * @param limit value for limit * @return {@code this} builder for chained invocation */ public final Builder limit(int limit) { this.limit = limit; initBits &= ~INIT_BIT_LIMIT; return this; } /** * Builds new {@link org.glowroot.common.live.ImmutableTracePointQuery ImmutableTracePointQuery}. * @return immutable instance of TracePointQuery * @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing */ public ImmutableTracePointQuery build() throws IllegalStateException { checkRequiredAttributes(); return new ImmutableTracePointQuery(this); } private boolean slowOnlyIsSet() { return (optBits & OPT_BIT_SLOW_ONLY) != 0; } private boolean errorOnlyIsSet() { return (optBits & OPT_BIT_ERROR_ONLY) != 0; } private boolean serverRollupIsSet() { return (initBits & INIT_BIT_SERVER_ROLLUP) == 0; } private boolean fromIsSet() { return (initBits & INIT_BIT_FROM) == 0; } private boolean toIsSet() { return (initBits & INIT_BIT_TO) == 0; } private boolean durationNanosLowIsSet() { return (initBits & INIT_BIT_DURATION_NANOS_LOW) == 0; } private boolean limitIsSet() { return (initBits & INIT_BIT_LIMIT) == 0; } private void checkRequiredAttributes() throws IllegalStateException { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if (!serverRollupIsSet()) attributes.add("serverRollup"); if (!fromIsSet()) attributes.add("from"); if (!toIsSet()) attributes.add("to"); if (!durationNanosLowIsSet()) attributes.add("durationNanosLow"); if (!limitIsSet()) attributes.add("limit"); return "Cannot build TracePointQuery, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy