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

org.glowroot.container.trace.TraceQuery Maven / Gradle / Ivy

The newest version!
package org.glowroot.container.trace;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.primitives.Booleans;
import com.google.common.primitives.Longs;
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 TraceQueryBase}.
 * 

* Use builder to create immutable instances: * {@code TraceQuery.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "TraceQueryBase"}) @Immutable public final class TraceQuery extends TraceQueryBase { private final long from; private final long to; private final long durationLow; private final @Nullable Long durationHigh; private final @Nullable String transactionType; private final @Nullable TraceQueryBase.StringComparator transactionNameComparator; private final @Nullable String transactionName; private final @Nullable TraceQueryBase.StringComparator headlineComparator; private final @Nullable String headline; private final @Nullable TraceQueryBase.StringComparator errorComparator; private final @Nullable String error; private final @Nullable TraceQueryBase.StringComparator userComparator; private final @Nullable String user; private final @Nullable String customAttributeName; private final @Nullable TraceQueryBase.StringComparator customAttributeValueComparator; private final @Nullable String customAttributeValue; private final boolean errorOnly; private final boolean slowOnly; private final int limit; private TraceQuery(TraceQuery.Builder builder) { this.durationHigh = builder.durationHigh; 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.customAttributeName = builder.customAttributeName; this.customAttributeValueComparator = builder.customAttributeValueComparator; this.customAttributeValue = builder.customAttributeValue; this.from = builder.fromIsSet() ? builder.from : super.from(); this.to = builder.toIsSet() ? builder.to : super.to(); this.durationLow = builder.durationLowIsSet() ? builder.durationLow : super.durationLow(); this.errorOnly = builder.errorOnlyIsSet() ? builder.errorOnly : super.errorOnly(); this.slowOnly = builder.slowOnlyIsSet() ? builder.slowOnly : super.slowOnly(); this.limit = builder.limitIsSet() ? builder.limit : super.limit(); } private TraceQuery( long from, long to, long durationLow, @Nullable Long durationHigh, @Nullable String transactionType, @Nullable TraceQueryBase.StringComparator transactionNameComparator, @Nullable String transactionName, @Nullable TraceQueryBase.StringComparator headlineComparator, @Nullable String headline, @Nullable TraceQueryBase.StringComparator errorComparator, @Nullable String error, @Nullable TraceQueryBase.StringComparator userComparator, @Nullable String user, @Nullable String customAttributeName, @Nullable TraceQueryBase.StringComparator customAttributeValueComparator, @Nullable String customAttributeValue, boolean errorOnly, boolean slowOnly, int limit) { this.from = from; this.to = to; this.durationLow = durationLow; this.durationHigh = durationHigh; 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.customAttributeName = customAttributeName; this.customAttributeValueComparator = customAttributeValueComparator; this.customAttributeValue = customAttributeValue; this.errorOnly = errorOnly; this.slowOnly = slowOnly; this.limit = limit; } /** * {@inheritDoc} * @return value of {@code from} attribute */ @Override public long from() { return from; } /** * {@inheritDoc} * @return value of {@code to} attribute */ @Override public long to() { return to; } /** * {@inheritDoc} * @return value of {@code durationLow} attribute */ @Override public long durationLow() { return durationLow; } /** * {@inheritDoc} * @return value of {@code durationHigh} attribute */ @Override public Long durationHigh() { return durationHigh; } /** * {@inheritDoc} * @return value of {@code transactionType} attribute */ @Override public String transactionType() { return transactionType; } /** * {@inheritDoc} * @return value of {@code transactionNameComparator} attribute */ @Override public TraceQueryBase.StringComparator transactionNameComparator() { return transactionNameComparator; } /** * {@inheritDoc} * @return value of {@code transactionName} attribute */ @Override public String transactionName() { return transactionName; } /** * {@inheritDoc} * @return value of {@code headlineComparator} attribute */ @Override public TraceQueryBase.StringComparator headlineComparator() { return headlineComparator; } /** * {@inheritDoc} * @return value of {@code headline} attribute */ @Override public String headline() { return headline; } /** * {@inheritDoc} * @return value of {@code errorComparator} attribute */ @Override public TraceQueryBase.StringComparator errorComparator() { return errorComparator; } /** * {@inheritDoc} * @return value of {@code error} attribute */ @Override public String error() { return error; } /** * {@inheritDoc} * @return value of {@code userComparator} attribute */ @Override public TraceQueryBase.StringComparator userComparator() { return userComparator; } /** * {@inheritDoc} * @return value of {@code user} attribute */ @Override public String user() { return user; } /** * {@inheritDoc} * @return value of {@code customAttributeName} attribute */ @Override public String customAttributeName() { return customAttributeName; } /** * {@inheritDoc} * @return value of {@code customAttributeValueComparator} attribute */ @Override public TraceQueryBase.StringComparator customAttributeValueComparator() { return customAttributeValueComparator; } /** * {@inheritDoc} * @return value of {@code customAttributeValue} attribute */ @Override public String customAttributeValue() { return customAttributeValue; } /** * {@inheritDoc} * @return value of {@code errorOnly} attribute */ @Override public boolean errorOnly() { return errorOnly; } /** * {@inheritDoc} * @return value of {@code slowOnly} attribute */ @Override public boolean slowOnly() { return slowOnly; } /** * {@inheritDoc} * @return value of {@code limit} attribute */ @Override public int limit() { return limit; } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withFrom(long value) { if (this.from == value) { return this; } long newValue = value; return new TraceQuery( newValue, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withTo(long value) { if (this.to == value) { return this; } long newValue = value; return new TraceQuery( this.from, newValue, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#durationLow() durationLow}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for durationLow * @return modified copy of the {@code this} object */ public final TraceQuery withDurationLow(long value) { if (this.durationLow == value) { return this; } long newValue = value; return new TraceQuery( this.from, this.to, newValue, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#durationHigh() durationHigh}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for durationHigh, can be {@code null} * @return modified copy of the {@code this} object */ public final TraceQuery withDurationHigh(@Nullable Long value) { if (this.durationHigh == value) { return this; } @Nullable Long newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, newValue, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withTransactionType(@Nullable String value) { if (this.transactionType == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, newValue, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withTransactionNameComparator(@Nullable TraceQueryBase.StringComparator value) { if (this.transactionNameComparator == value) { return this; } @Nullable TraceQueryBase.StringComparator newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, newValue, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withTransactionName(@Nullable String value) { if (this.transactionName == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, newValue, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withHeadlineComparator(@Nullable TraceQueryBase.StringComparator value) { if (this.headlineComparator == value) { return this; } @Nullable TraceQueryBase.StringComparator newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, newValue, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withHeadline(@Nullable String value) { if (this.headline == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, newValue, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withErrorComparator(@Nullable TraceQueryBase.StringComparator value) { if (this.errorComparator == value) { return this; } @Nullable TraceQueryBase.StringComparator newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, newValue, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withError(@Nullable String value) { if (this.error == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, newValue, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withUserComparator(@Nullable TraceQueryBase.StringComparator value) { if (this.userComparator == value) { return this; } @Nullable TraceQueryBase.StringComparator newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, newValue, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withUser(@Nullable String value) { if (this.user == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, newValue, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#customAttributeName() customAttributeName}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for customAttributeName, can be {@code null} * @return modified copy of the {@code this} object */ public final TraceQuery withCustomAttributeName(@Nullable String value) { if (this.customAttributeName == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, newValue, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#customAttributeValueComparator() customAttributeValueComparator}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for customAttributeValueComparator, can be {@code null} * @return modified copy of the {@code this} object */ public final TraceQuery withCustomAttributeValueComparator(@Nullable TraceQueryBase.StringComparator value) { if (this.customAttributeValueComparator == value) { return this; } @Nullable TraceQueryBase.StringComparator newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, newValue, this.customAttributeValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#customAttributeValue() customAttributeValue}. * Shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for customAttributeValue, can be {@code null} * @return modified copy of the {@code this} object */ public final TraceQuery withCustomAttributeValue(@Nullable String value) { if (this.customAttributeValue == value) { return this; } @Nullable String newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, newValue, this.errorOnly, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withErrorOnly(boolean value) { if (this.errorOnly == value) { return this; } boolean newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, newValue, this.slowOnly, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withSlowOnly(boolean value) { if (this.slowOnly == value) { return this; } boolean newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, newValue, this.limit); } /** * Copy current immutable object by setting value for {@link TraceQueryBase#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 TraceQuery withLimit(int value) { if (this.limit == value) { return this; } int newValue = value; return new TraceQuery( this.from, this.to, this.durationLow, this.durationHigh, this.transactionType, this.transactionNameComparator, this.transactionName, this.headlineComparator, this.headline, this.errorComparator, this.error, this.userComparator, this.user, this.customAttributeName, this.customAttributeValueComparator, this.customAttributeValue, this.errorOnly, this.slowOnly, newValue); } /** * This instance is equal to instances of {@code TraceQuery} with equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { return this == another || (another instanceof TraceQuery && equalTo((TraceQuery) another)); } private boolean equalTo(TraceQuery another) { return from == another.from && to == another.to && durationLow == another.durationLow && Objects.equal(durationHigh, another.durationHigh) && 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(customAttributeName, another.customAttributeName) && Objects.equal(customAttributeValueComparator, another.customAttributeValueComparator) && Objects.equal(customAttributeValue, another.customAttributeValue) && errorOnly == another.errorOnly && slowOnly == another.slowOnly && limit == another.limit; } /** * Computes hash code from attributes: {@code from}, {@code to}, {@code durationLow}, {@code durationHigh}, {@code transactionType}, {@code transactionNameComparator}, {@code transactionName}, {@code headlineComparator}, {@code headline}, {@code errorComparator}, {@code error}, {@code userComparator}, {@code user}, {@code customAttributeName}, {@code customAttributeValueComparator}, {@code customAttributeValue}, {@code errorOnly}, {@code slowOnly}, {@code limit}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + Longs.hashCode(from); h = h * 17 + Longs.hashCode(to); h = h * 17 + Longs.hashCode(durationLow); h = h * 17 + Objects.hashCode(durationHigh); 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(customAttributeName); h = h * 17 + Objects.hashCode(customAttributeValueComparator); h = h * 17 + Objects.hashCode(customAttributeValue); h = h * 17 + Booleans.hashCode(errorOnly); h = h * 17 + Booleans.hashCode(slowOnly); h = h * 17 + limit; return h; } /** * Prints immutable value {@code TraceQuery{...}} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("TraceQuery") .add("from", from) .add("to", to) .add("durationLow", durationLow) .add("durationHigh", durationHigh) .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("customAttributeName", customAttributeName) .add("customAttributeValueComparator", customAttributeValueComparator) .add("customAttributeValue", customAttributeValue) .add("errorOnly", errorOnly) .add("slowOnly", slowOnly) .add("limit", limit) .toString(); } /** * Creates immutable copy of {@link TraceQueryBase}. * 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 TraceQuery instance */ public static TraceQuery copyOf(TraceQueryBase instance) { if (instance instanceof TraceQuery) { return (TraceQuery) instance; } return TraceQuery.builder() .from(instance.from()) .to(instance.to()) .durationLow(instance.durationLow()) .durationHigh(instance.durationHigh()) .transactionType(instance.transactionType()) .transactionNameComparator(instance.transactionNameComparator()) .transactionName(instance.transactionName()) .headlineComparator(instance.headlineComparator()) .headline(instance.headline()) .errorComparator(instance.errorComparator()) .error(instance.error()) .userComparator(instance.userComparator()) .user(instance.user()) .customAttributeName(instance.customAttributeName()) .customAttributeValueComparator(instance.customAttributeValueComparator()) .customAttributeValue(instance.customAttributeValue()) .errorOnly(instance.errorOnly()) .slowOnly(instance.slowOnly()) .limit(instance.limit()) .build(); } /** * Creates builder for {@link org.glowroot.container.trace.TraceQuery}. * @return new TraceQuery builder */ public static TraceQuery.Builder builder() { return new TraceQuery.Builder(); } /** * Builds instances of {@link org.glowroot.container.trace.TraceQuery}. * Initialized attributes and then invoke {@link #build()} method to create * immutable instance. *

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 NONDEFAULT_BIT_FROM = 0x1L; private static final long NONDEFAULT_BIT_TO = 0x2L; private static final long NONDEFAULT_BIT_DURATION_LOW = 0x4L; private static final long NONDEFAULT_BIT_DURATION_HIGH = 0x8L; private static final long NONDEFAULT_BIT_TRANSACTION_TYPE = 0x10L; private static final long NONDEFAULT_BIT_TRANSACTION_NAME_COMPARATOR = 0x20L; private static final long NONDEFAULT_BIT_TRANSACTION_NAME = 0x40L; private static final long NONDEFAULT_BIT_HEADLINE_COMPARATOR = 0x80L; private static final long NONDEFAULT_BIT_HEADLINE = 0x100L; private static final long NONDEFAULT_BIT_ERROR_COMPARATOR = 0x200L; private static final long NONDEFAULT_BIT_ERROR = 0x400L; private static final long NONDEFAULT_BIT_USER_COMPARATOR = 0x800L; private static final long NONDEFAULT_BIT_USER = 0x1000L; private static final long NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_NAME = 0x2000L; private static final long NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE_COMPARATOR = 0x4000L; private static final long NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE = 0x8000L; private static final long NONDEFAULT_BIT_ERROR_ONLY = 0x10000L; private static final long NONDEFAULT_BIT_SLOW_ONLY = 0x20000L; private static final long NONDEFAULT_BIT_LIMIT = 0x40000L; private long nondefaultBitset; private long from; private long to; private long durationLow; private @Nullable Long durationHigh; private @Nullable String transactionType; private @Nullable TraceQueryBase.StringComparator transactionNameComparator; private @Nullable String transactionName; private @Nullable TraceQueryBase.StringComparator headlineComparator; private @Nullable String headline; private @Nullable TraceQueryBase.StringComparator errorComparator; private @Nullable String error; private @Nullable TraceQueryBase.StringComparator userComparator; private @Nullable String user; private @Nullable String customAttributeName; private @Nullable TraceQueryBase.StringComparator customAttributeValueComparator; private @Nullable String customAttributeValue; private boolean errorOnly; private boolean slowOnly; private int limit; private Builder() {} /** * Initializes value for {@link TraceQueryBase#from() from}. *

If not set, this attribute will have default value returned by initializer of {@link TraceQueryBase#from() from}. * @param from value for from * @return {@code this} builder for chained invocation */ public final Builder from(long from) { checkNotIsSet(fromIsSet(), "from"); this.from = from; nondefaultBitset |= NONDEFAULT_BIT_FROM; return this; } /** * Initializes value for {@link TraceQueryBase#to() to}. *

If not set, this attribute will have default value returned by initializer of {@link TraceQueryBase#to() to}. * @param to value for to * @return {@code this} builder for chained invocation */ public final Builder to(long to) { checkNotIsSet(toIsSet(), "to"); this.to = to; nondefaultBitset |= NONDEFAULT_BIT_TO; return this; } /** * Initializes value for {@link TraceQueryBase#durationLow() durationLow}. *

If not set, this attribute will have default value returned by initializer of {@link TraceQueryBase#durationLow() durationLow}. * @param durationLow value for durationLow * @return {@code this} builder for chained invocation */ public final Builder durationLow(long durationLow) { checkNotIsSet(durationLowIsSet(), "durationLow"); this.durationLow = durationLow; nondefaultBitset |= NONDEFAULT_BIT_DURATION_LOW; return this; } /** * Initializes value for {@link TraceQueryBase#durationHigh() durationHigh}. * @param durationHigh value for durationHigh, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder durationHigh(@Nullable Long durationHigh) { checkNotIsSet(durationHighIsSet(), "durationHigh"); this.durationHigh = durationHigh; nondefaultBitset |= NONDEFAULT_BIT_DURATION_HIGH; return this; } /** * Initializes value for {@link TraceQueryBase#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) { checkNotIsSet(transactionTypeIsSet(), "transactionType"); this.transactionType = transactionType; nondefaultBitset |= NONDEFAULT_BIT_TRANSACTION_TYPE; return this; } /** * Initializes value for {@link TraceQueryBase#transactionNameComparator() transactionNameComparator}. * @param transactionNameComparator value for transactionNameComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder transactionNameComparator(@Nullable TraceQueryBase.StringComparator transactionNameComparator) { checkNotIsSet(transactionNameComparatorIsSet(), "transactionNameComparator"); this.transactionNameComparator = transactionNameComparator; nondefaultBitset |= NONDEFAULT_BIT_TRANSACTION_NAME_COMPARATOR; return this; } /** * Initializes value for {@link TraceQueryBase#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) { checkNotIsSet(transactionNameIsSet(), "transactionName"); this.transactionName = transactionName; nondefaultBitset |= NONDEFAULT_BIT_TRANSACTION_NAME; return this; } /** * Initializes value for {@link TraceQueryBase#headlineComparator() headlineComparator}. * @param headlineComparator value for headlineComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder headlineComparator(@Nullable TraceQueryBase.StringComparator headlineComparator) { checkNotIsSet(headlineComparatorIsSet(), "headlineComparator"); this.headlineComparator = headlineComparator; nondefaultBitset |= NONDEFAULT_BIT_HEADLINE_COMPARATOR; return this; } /** * Initializes value for {@link TraceQueryBase#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) { checkNotIsSet(headlineIsSet(), "headline"); this.headline = headline; nondefaultBitset |= NONDEFAULT_BIT_HEADLINE; return this; } /** * Initializes value for {@link TraceQueryBase#errorComparator() errorComparator}. * @param errorComparator value for errorComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder errorComparator(@Nullable TraceQueryBase.StringComparator errorComparator) { checkNotIsSet(errorComparatorIsSet(), "errorComparator"); this.errorComparator = errorComparator; nondefaultBitset |= NONDEFAULT_BIT_ERROR_COMPARATOR; return this; } /** * Initializes value for {@link TraceQueryBase#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) { checkNotIsSet(errorIsSet(), "error"); this.error = error; nondefaultBitset |= NONDEFAULT_BIT_ERROR; return this; } /** * Initializes value for {@link TraceQueryBase#userComparator() userComparator}. * @param userComparator value for userComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder userComparator(@Nullable TraceQueryBase.StringComparator userComparator) { checkNotIsSet(userComparatorIsSet(), "userComparator"); this.userComparator = userComparator; nondefaultBitset |= NONDEFAULT_BIT_USER_COMPARATOR; return this; } /** * Initializes value for {@link TraceQueryBase#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) { checkNotIsSet(userIsSet(), "user"); this.user = user; nondefaultBitset |= NONDEFAULT_BIT_USER; return this; } /** * Initializes value for {@link TraceQueryBase#customAttributeName() customAttributeName}. * @param customAttributeName value for customAttributeName, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder customAttributeName(@Nullable String customAttributeName) { checkNotIsSet(customAttributeNameIsSet(), "customAttributeName"); this.customAttributeName = customAttributeName; nondefaultBitset |= NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_NAME; return this; } /** * Initializes value for {@link TraceQueryBase#customAttributeValueComparator() customAttributeValueComparator}. * @param customAttributeValueComparator value for customAttributeValueComparator, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder customAttributeValueComparator(@Nullable TraceQueryBase.StringComparator customAttributeValueComparator) { checkNotIsSet(customAttributeValueComparatorIsSet(), "customAttributeValueComparator"); this.customAttributeValueComparator = customAttributeValueComparator; nondefaultBitset |= NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE_COMPARATOR; return this; } /** * Initializes value for {@link TraceQueryBase#customAttributeValue() customAttributeValue}. * @param customAttributeValue value for customAttributeValue, can be {@code null} * @return {@code this} builder for chained invocation */ public final Builder customAttributeValue(@Nullable String customAttributeValue) { checkNotIsSet(customAttributeValueIsSet(), "customAttributeValue"); this.customAttributeValue = customAttributeValue; nondefaultBitset |= NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE; return this; } /** * Initializes value for {@link TraceQueryBase#errorOnly() errorOnly}. *

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

If not set, this attribute will have default value returned by initializer of {@link TraceQueryBase#slowOnly() slowOnly}. * @param slowOnly value for slowOnly * @return {@code this} builder for chained invocation */ public final Builder slowOnly(boolean slowOnly) { checkNotIsSet(slowOnlyIsSet(), "slowOnly"); this.slowOnly = slowOnly; nondefaultBitset |= NONDEFAULT_BIT_SLOW_ONLY; return this; } /** * Initializes value for {@link TraceQueryBase#limit() limit}. *

If not set, this attribute will have default value returned by initializer of {@link TraceQueryBase#limit() limit}. * @param limit value for limit * @return {@code this} builder for chained invocation */ public final Builder limit(int limit) { checkNotIsSet(limitIsSet(), "limit"); this.limit = limit; nondefaultBitset |= NONDEFAULT_BIT_LIMIT; return this; } /** * Builds new {@link org.glowroot.container.trace.TraceQuery}. * @return immutable instance of TraceQuery */ public TraceQuery build() { return new TraceQuery(this); } private boolean fromIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_FROM) != 0; } private boolean toIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_TO) != 0; } private boolean durationLowIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_DURATION_LOW) != 0; } private boolean durationHighIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_DURATION_HIGH) != 0; } private boolean transactionTypeIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_TRANSACTION_TYPE) != 0; } private boolean transactionNameComparatorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_TRANSACTION_NAME_COMPARATOR) != 0; } private boolean transactionNameIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_TRANSACTION_NAME) != 0; } private boolean headlineComparatorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_HEADLINE_COMPARATOR) != 0; } private boolean headlineIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_HEADLINE) != 0; } private boolean errorComparatorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_ERROR_COMPARATOR) != 0; } private boolean errorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_ERROR) != 0; } private boolean userComparatorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_USER_COMPARATOR) != 0; } private boolean userIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_USER) != 0; } private boolean customAttributeNameIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_NAME) != 0; } private boolean customAttributeValueComparatorIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE_COMPARATOR) != 0; } private boolean customAttributeValueIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_CUSTOM_ATTRIBUTE_VALUE) != 0; } private boolean errorOnlyIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_ERROR_ONLY) != 0; } private boolean slowOnlyIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_SLOW_ONLY) != 0; } private boolean limitIsSet() { return (nondefaultBitset & NONDEFAULT_BIT_LIMIT) != 0; } private void checkNotIsSet(boolean isSet, String name) { if (isSet) { throw new IllegalStateException("Builder of TraceQuery is strict, attribute is already set: ".concat(name)); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy