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

org.glowroot.agent.shaded.glowroot.ui.ImmutableTransactionProfileRequest Maven / Gradle / Ivy

There is a newer version: 0.9.24
Show newest version
package org.glowroot.agent.shaded.glowroot.ui;

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.ImmutableList;
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.Doubles;
import org.glowroot.agent.shaded.google.common.primitives.Longs;
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 TransactionJsonService.TransactionProfileRequest}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableTransactionProfileRequest.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "TransactionJsonService.TransactionProfileRequest"}) @Immutable final class ImmutableTransactionProfileRequest implements TransactionJsonService.TransactionProfileRequest { private final boolean auxiliary; private final ImmutableList include; private final ImmutableList exclude; private final double truncateBranchPercentage; private final String agentRollup; private final String transactionType; private final @Nullable String transactionName; private final long from; private final long to; private ImmutableTransactionProfileRequest( boolean auxiliary, ImmutableList include, ImmutableList exclude, double truncateBranchPercentage, String agentRollup, String transactionType, @Nullable String transactionName, long from, long to) { this.auxiliary = auxiliary; this.include = include; this.exclude = exclude; this.truncateBranchPercentage = truncateBranchPercentage; this.agentRollup = agentRollup; this.transactionType = transactionType; this.transactionName = transactionName; this.from = from; this.to = to; } /** * @return The value of the {@code auxiliary} attribute */ @JsonProperty @Override public boolean auxiliary() { return auxiliary; } /** * @return The value of the {@code include} attribute */ @JsonProperty @Override public ImmutableList include() { return include; } /** * @return The value of the {@code exclude} attribute */ @JsonProperty @Override public ImmutableList exclude() { return exclude; } /** * @return The value of the {@code truncateBranchPercentage} attribute */ @JsonProperty @Override public double truncateBranchPercentage() { return truncateBranchPercentage; } /** * @return The value of the {@code agentRollup} attribute */ @JsonProperty @Override public String agentRollup() { return agentRollup; } /** * @return The value of the {@code transactionType} attribute */ @JsonProperty @Override public String transactionType() { return transactionType; } /** * @return The value of the {@code transactionName} attribute */ @JsonProperty @Override public @Nullable String transactionName() { return transactionName; } /** * @return The value of the {@code from} attribute */ @JsonProperty @Override public long from() { return from; } /** * @return The value of the {@code to} attribute */ @JsonProperty @Override public long to() { return to; } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#auxiliary() auxiliary} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for auxiliary * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withAuxiliary(boolean value) { if (this.auxiliary == value) return this; return new ImmutableTransactionProfileRequest( value, this.include, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object with elements that replace the content of {@link TransactionJsonService.TransactionProfileRequest#include() include}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableTransactionProfileRequest withInclude(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableTransactionProfileRequest( this.auxiliary, newValue, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object with elements that replace the content of {@link TransactionJsonService.TransactionProfileRequest#include() include}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of include elements to set * @return A modified copy of {@code this} object */ public final ImmutableTransactionProfileRequest withInclude(Iterable elements) { if (this.include == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableTransactionProfileRequest( this.auxiliary, newValue, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object with elements that replace the content of {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableTransactionProfileRequest withExclude(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, newValue, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object with elements that replace the content of {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of exclude elements to set * @return A modified copy of {@code this} object */ public final ImmutableTransactionProfileRequest withExclude(Iterable elements) { if (this.exclude == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, newValue, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#truncateBranchPercentage() truncateBranchPercentage} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for truncateBranchPercentage * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withTruncateBranchPercentage(double value) { if (Double.doubleToLongBits(this.truncateBranchPercentage) == Double.doubleToLongBits(value)) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, value, this.agentRollup, this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#agentRollup() agentRollup} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for agentRollup * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withAgentRollup(String value) { if (this.agentRollup.equals(value)) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, this.truncateBranchPercentage, Preconditions.checkNotNull(value, "agentRollup"), this.transactionType, this.transactionName, this.from, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#transactionType() transactionType} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for transactionType * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withTransactionType(String value) { if (this.transactionType.equals(value)) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, this.truncateBranchPercentage, this.agentRollup, Preconditions.checkNotNull(value, "transactionType"), this.transactionName, this.from, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#transactionName() transactionName} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for transactionName (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withTransactionName(@Nullable String value) { if (Objects.equal(this.transactionName, value)) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, value, this.from, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#from() from} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for from * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withFrom(long value) { if (this.from == value) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, value, this.to); } /** * Copy the current immutable object by setting a value for the {@link TransactionJsonService.TransactionProfileRequest#to() to} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for to * @return A modified copy of the {@code this} object */ public final ImmutableTransactionProfileRequest withTo(long value) { if (this.to == value) return this; return new ImmutableTransactionProfileRequest( this.auxiliary, this.include, this.exclude, this.truncateBranchPercentage, this.agentRollup, this.transactionType, this.transactionName, this.from, value); } /** * This instance is equal to all instances of {@code ImmutableTransactionProfileRequest} 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 ImmutableTransactionProfileRequest && equalTo((ImmutableTransactionProfileRequest) another); } private boolean equalTo(ImmutableTransactionProfileRequest another) { return auxiliary == another.auxiliary && include.equals(another.include) && exclude.equals(another.exclude) && Double.doubleToLongBits(truncateBranchPercentage) == Double.doubleToLongBits(another.truncateBranchPercentage) && agentRollup.equals(another.agentRollup) && transactionType.equals(another.transactionType) && Objects.equal(transactionName, another.transactionName) && from == another.from && to == another.to; } /** * Computes a hash code from attributes: {@code auxiliary}, {@code include}, {@code exclude}, {@code truncateBranchPercentage}, {@code agentRollup}, {@code transactionType}, {@code transactionName}, {@code from}, {@code to}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + Booleans.hashCode(auxiliary); h = h * 17 + include.hashCode(); h = h * 17 + exclude.hashCode(); h = h * 17 + Doubles.hashCode(truncateBranchPercentage); h = h * 17 + agentRollup.hashCode(); h = h * 17 + transactionType.hashCode(); h = h * 17 + Objects.hashCode(transactionName); h = h * 17 + Longs.hashCode(from); h = h * 17 + Longs.hashCode(to); return h; } /** * Prints the immutable value {@code TransactionProfileRequest...} with all non-generated * and non-auxiliary attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("TransactionProfileRequest") .add("auxiliary", auxiliary) .add("include", include) .add("exclude", exclude) .add("truncateBranchPercentage", truncateBranchPercentage) .add("agentRollup", agentRollup) .add("transactionType", transactionType) .add("transactionName", transactionName) .add("from", from) .add("to", to) .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 */ @Deprecated static final class Json implements TransactionJsonService.TransactionProfileRequest { @Nullable Boolean auxiliary; ImmutableList include = ImmutableList.of(); ImmutableList exclude = ImmutableList.of(); @Nullable Double truncateBranchPercentage; @Nullable String agentRollup; @Nullable String transactionType; @Nullable String transactionName; @Nullable Long from; @Nullable Long to; @JsonProperty public void setAuxiliary(boolean auxiliary) { this.auxiliary = auxiliary; } @JsonProperty public void setInclude(ImmutableList include) { this.include = include; } @JsonProperty public void setExclude(ImmutableList exclude) { this.exclude = exclude; } @JsonProperty public void setTruncateBranchPercentage(double truncateBranchPercentage) { this.truncateBranchPercentage = truncateBranchPercentage; } @JsonProperty public void setAgentRollup(String agentRollup) { this.agentRollup = agentRollup; } @JsonProperty public void setTransactionType(String transactionType) { this.transactionType = transactionType; } @JsonProperty public void setTransactionName(@Nullable String transactionName) { this.transactionName = transactionName; } @JsonProperty public void setFrom(long from) { this.from = from; } @JsonProperty public void setTo(long to) { this.to = to; } @Override public boolean auxiliary() { throw new UnsupportedOperationException(); } @Override public ImmutableList include() { throw new UnsupportedOperationException(); } @Override public ImmutableList exclude() { throw new UnsupportedOperationException(); } @Override public double truncateBranchPercentage() { throw new UnsupportedOperationException(); } @Override public String agentRollup() { throw new UnsupportedOperationException(); } @Override public String transactionType() { throw new UnsupportedOperationException(); } @Override public String transactionName() { throw new UnsupportedOperationException(); } @Override public long from() { throw new UnsupportedOperationException(); } @Override public long to() { 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 static ImmutableTransactionProfileRequest fromJson(Json json) { ImmutableTransactionProfileRequest.Builder builder = ImmutableTransactionProfileRequest.builder(); if (json.auxiliary != null) { builder.auxiliary(json.auxiliary); } if (json.include != null) { builder.addAllInclude(json.include); } if (json.exclude != null) { builder.addAllExclude(json.exclude); } if (json.truncateBranchPercentage != null) { builder.truncateBranchPercentage(json.truncateBranchPercentage); } if (json.agentRollup != null) { builder.agentRollup(json.agentRollup); } if (json.transactionType != null) { builder.transactionType(json.transactionType); } if (json.transactionName != null) { builder.transactionName(json.transactionName); } if (json.from != null) { builder.from(json.from); } if (json.to != null) { builder.to(json.to); } return builder.build(); } /** * Creates an immutable copy of a {@link TransactionJsonService.TransactionProfileRequest} 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 TransactionProfileRequest instance */ public static ImmutableTransactionProfileRequest copyOf(TransactionJsonService.TransactionProfileRequest instance) { if (instance instanceof ImmutableTransactionProfileRequest) { return (ImmutableTransactionProfileRequest) instance; } return ImmutableTransactionProfileRequest.builder() .copyFrom(instance) .build(); } /** * Creates a builder for {@link ImmutableTransactionProfileRequest ImmutableTransactionProfileRequest}. * @return A new ImmutableTransactionProfileRequest builder */ public static ImmutableTransactionProfileRequest.Builder builder() { return new ImmutableTransactionProfileRequest.Builder(); } /** * Builds instances of type {@link ImmutableTransactionProfileRequest ImmutableTransactionProfileRequest}. * 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. */ @NotThreadSafe static final class Builder { private static final long INIT_BIT_AUXILIARY = 0x1L; private static final long INIT_BIT_TRUNCATE_BRANCH_PERCENTAGE = 0x2L; private static final long INIT_BIT_AGENT_ROLLUP = 0x4L; private static final long INIT_BIT_TRANSACTION_TYPE = 0x8L; private static final long INIT_BIT_FROM = 0x10L; private static final long INIT_BIT_TO = 0x20L; private long initBits = 0x3f; private boolean auxiliary; private ImmutableList.Builder includeBuilder = ImmutableList.builder(); private ImmutableList.Builder excludeBuilder = ImmutableList.builder(); private double truncateBranchPercentage; private @Nullable String agentRollup; private @Nullable String transactionType; private @Nullable String transactionName; private long from; private long to; private Builder() { } /** * Fill a builder with attribute values from the provided {@code org.glowroot.agent.shaded.glowroot.ui.TransactionJsonService.TransactionProfileRequest} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder copyFrom(TransactionJsonService.TransactionProfileRequest instance) { Preconditions.checkNotNull(instance, "instance"); from((Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code org.glowroot.agent.shaded.glowroot.ui.TransactionJsonService.RequestBase} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder copyFrom(TransactionJsonService.RequestBase instance) { Preconditions.checkNotNull(instance, "instance"); from((Object) instance); return this; } private void from(Object object) { if (object instanceof TransactionJsonService.TransactionProfileRequest) { TransactionJsonService.TransactionProfileRequest instance = (TransactionJsonService.TransactionProfileRequest) object; addAllInclude(instance.include()); addAllExclude(instance.exclude()); truncateBranchPercentage(instance.truncateBranchPercentage()); auxiliary(instance.auxiliary()); } if (object instanceof TransactionJsonService.RequestBase) { TransactionJsonService.RequestBase instance = (TransactionJsonService.RequestBase) object; transactionType(instance.transactionType()); agentRollup(instance.agentRollup()); from(instance.from()); to(instance.to()); @Nullable String transactionNameValue = instance.transactionName(); if (transactionNameValue != null) { transactionName(transactionNameValue); } } } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#auxiliary() auxiliary} attribute. * @param auxiliary The value for auxiliary * @return {@code this} builder for use in a chained invocation */ public final Builder auxiliary(boolean auxiliary) { this.auxiliary = auxiliary; initBits &= ~INIT_BIT_AUXILIARY; return this; } /** * Adds one element to {@link TransactionJsonService.TransactionProfileRequest#include() include} list. * @param element A include element * @return {@code this} builder for use in a chained invocation */ public final Builder addInclude(String element) { includeBuilder.add(element); return this; } /** * Adds elements to {@link TransactionJsonService.TransactionProfileRequest#include() include} list. * @param elements An array of include elements * @return {@code this} builder for use in a chained invocation */ public final Builder addInclude(String... elements) { includeBuilder.add(elements); return this; } /** * Sets or replaces all elements for {@link TransactionJsonService.TransactionProfileRequest#include() include} list. * @param elements An iterable of include elements * @return {@code this} builder for use in a chained invocation */ public final Builder include(Iterable elements) { includeBuilder = ImmutableList.builder(); return addAllInclude(elements); } /** * Adds elements to {@link TransactionJsonService.TransactionProfileRequest#include() include} list. * @param elements An iterable of include elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllInclude(Iterable elements) { includeBuilder.addAll(elements); return this; } /** * Adds one element to {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude} list. * @param element A exclude element * @return {@code this} builder for use in a chained invocation */ public final Builder addExclude(String element) { excludeBuilder.add(element); return this; } /** * Adds elements to {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude} list. * @param elements An array of exclude elements * @return {@code this} builder for use in a chained invocation */ public final Builder addExclude(String... elements) { excludeBuilder.add(elements); return this; } /** * Sets or replaces all elements for {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude} list. * @param elements An iterable of exclude elements * @return {@code this} builder for use in a chained invocation */ public final Builder exclude(Iterable elements) { excludeBuilder = ImmutableList.builder(); return addAllExclude(elements); } /** * Adds elements to {@link TransactionJsonService.TransactionProfileRequest#exclude() exclude} list. * @param elements An iterable of exclude elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllExclude(Iterable elements) { excludeBuilder.addAll(elements); return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#truncateBranchPercentage() truncateBranchPercentage} attribute. * @param truncateBranchPercentage The value for truncateBranchPercentage * @return {@code this} builder for use in a chained invocation */ public final Builder truncateBranchPercentage(double truncateBranchPercentage) { this.truncateBranchPercentage = truncateBranchPercentage; initBits &= ~INIT_BIT_TRUNCATE_BRANCH_PERCENTAGE; return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#agentRollup() agentRollup} attribute. * @param agentRollup The value for agentRollup * @return {@code this} builder for use in a chained invocation */ public final Builder agentRollup(String agentRollup) { this.agentRollup = Preconditions.checkNotNull(agentRollup, "agentRollup"); initBits &= ~INIT_BIT_AGENT_ROLLUP; return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#transactionType() transactionType} attribute. * @param transactionType The value for transactionType * @return {@code this} builder for use in a chained invocation */ public final Builder transactionType(String transactionType) { this.transactionType = Preconditions.checkNotNull(transactionType, "transactionType"); initBits &= ~INIT_BIT_TRANSACTION_TYPE; return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#transactionName() transactionName} attribute. * @param transactionName The value for transactionName (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder transactionName(@Nullable String transactionName) { this.transactionName = transactionName; return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#from() from} attribute. * @param from The value for from * @return {@code this} builder for use in a chained invocation */ public final Builder from(long from) { this.from = from; initBits &= ~INIT_BIT_FROM; return this; } /** * Initializes the value for the {@link TransactionJsonService.TransactionProfileRequest#to() to} attribute. * @param to The value for to * @return {@code this} builder for use in a chained invocation */ public final Builder to(long to) { this.to = to; initBits &= ~INIT_BIT_TO; return this; } /** * Builds a new {@link ImmutableTransactionProfileRequest ImmutableTransactionProfileRequest}. * @return An immutable instance of TransactionProfileRequest * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableTransactionProfileRequest build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableTransactionProfileRequest( auxiliary, includeBuilder.build(), excludeBuilder.build(), truncateBranchPercentage, agentRollup, transactionType, transactionName, from, to); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_AUXILIARY) != 0) attributes.add("auxiliary"); if ((initBits & INIT_BIT_TRUNCATE_BRANCH_PERCENTAGE) != 0) attributes.add("truncateBranchPercentage"); if ((initBits & INIT_BIT_AGENT_ROLLUP) != 0) attributes.add("agentRollup"); if ((initBits & INIT_BIT_TRANSACTION_TYPE) != 0) attributes.add("transactionType"); if ((initBits & INIT_BIT_FROM) != 0) attributes.add("from"); if ((initBits & INIT_BIT_TO) != 0) attributes.add("to"); return "Cannot build TransactionProfileRequest, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy