
org.glowroot.agent.shaded.glowroot.ui.ImmutableAdvancedConfigDto Maven / Gradle / Ivy
Show all versions of glowroot-agent-it-harness Show documentation
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.Optional;
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 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 ConfigJsonService.AdvancedConfigDto}.
*
* Use the builder to create immutable instances:
* {@code ImmutableAdvancedConfigDto.builder()}.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "ConfigJsonService.AdvancedConfigDto"})
@Immutable
final class ImmutableAdvancedConfigDto extends ConfigJsonService.AdvancedConfigDto {
private final Optional agentId;
private final boolean weavingTimer;
private final int immediatePartialStoreThresholdSeconds;
private final int maxAggregateTransactionsPerType;
private final int maxAggregateQueriesPerType;
private final int maxAggregateServiceCallsPerType;
private final int maxTraceEntriesPerTransaction;
private final int maxStackTraceSamplesPerTransaction;
private final int mbeanGaugeNotFoundDelaySeconds;
private final String version;
private ImmutableAdvancedConfigDto(
Optional agentId,
boolean weavingTimer,
int immediatePartialStoreThresholdSeconds,
int maxAggregateTransactionsPerType,
int maxAggregateQueriesPerType,
int maxAggregateServiceCallsPerType,
int maxTraceEntriesPerTransaction,
int maxStackTraceSamplesPerTransaction,
int mbeanGaugeNotFoundDelaySeconds,
String version) {
this.agentId = agentId;
this.weavingTimer = weavingTimer;
this.immediatePartialStoreThresholdSeconds = immediatePartialStoreThresholdSeconds;
this.maxAggregateTransactionsPerType = maxAggregateTransactionsPerType;
this.maxAggregateQueriesPerType = maxAggregateQueriesPerType;
this.maxAggregateServiceCallsPerType = maxAggregateServiceCallsPerType;
this.maxTraceEntriesPerTransaction = maxTraceEntriesPerTransaction;
this.maxStackTraceSamplesPerTransaction = maxStackTraceSamplesPerTransaction;
this.mbeanGaugeNotFoundDelaySeconds = mbeanGaugeNotFoundDelaySeconds;
this.version = version;
}
/**
* @return The value of the {@code agentId} attribute
*/
@JsonProperty
@Override
Optional agentId() {
return agentId;
}
/**
* @return The value of the {@code weavingTimer} attribute
*/
@JsonProperty
@Override
boolean weavingTimer() {
return weavingTimer;
}
/**
* @return The value of the {@code immediatePartialStoreThresholdSeconds} attribute
*/
@JsonProperty
@Override
int immediatePartialStoreThresholdSeconds() {
return immediatePartialStoreThresholdSeconds;
}
/**
* @return The value of the {@code maxAggregateTransactionsPerType} attribute
*/
@JsonProperty
@Override
int maxAggregateTransactionsPerType() {
return maxAggregateTransactionsPerType;
}
/**
* @return The value of the {@code maxAggregateQueriesPerType} attribute
*/
@JsonProperty
@Override
int maxAggregateQueriesPerType() {
return maxAggregateQueriesPerType;
}
/**
* @return The value of the {@code maxAggregateServiceCallsPerType} attribute
*/
@JsonProperty
@Override
int maxAggregateServiceCallsPerType() {
return maxAggregateServiceCallsPerType;
}
/**
* @return The value of the {@code maxTraceEntriesPerTransaction} attribute
*/
@JsonProperty
@Override
int maxTraceEntriesPerTransaction() {
return maxTraceEntriesPerTransaction;
}
/**
* @return The value of the {@code maxStackTraceSamplesPerTransaction} attribute
*/
@JsonProperty
@Override
int maxStackTraceSamplesPerTransaction() {
return maxStackTraceSamplesPerTransaction;
}
/**
* @return The value of the {@code mbeanGaugeNotFoundDelaySeconds} attribute
*/
@JsonProperty
@Override
int mbeanGaugeNotFoundDelaySeconds() {
return mbeanGaugeNotFoundDelaySeconds;
}
/**
* @return The value of the {@code version} attribute
*/
@JsonProperty
@Override
String version() {
return version;
}
/**
* Copy the current immutable object by setting a present value for the optional {@link ConfigJsonService.AdvancedConfigDto#agentId() agentId} attribute.
* @param value The value for agentId
* @return A modified copy of {@code this} object
*/
public final ImmutableAdvancedConfigDto withAgentId(String value) {
Optional newValue = Optional.of(value);
if (this.agentId.equals(newValue)) return this;
return new ImmutableAdvancedConfigDto(
newValue,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting an optional value for the {@link ConfigJsonService.AdvancedConfigDto#agentId() agentId} attribute.
* An equality check is used to prevent copying of the same value by returning {@code this}.
* @param optional A value for agentId
* @return A modified copy of {@code this} object
*/
public final ImmutableAdvancedConfigDto withAgentId(Optional optional) {
Optional value = Preconditions.checkNotNull(optional, "agentId");
if (this.agentId.equals(value)) return this;
return new ImmutableAdvancedConfigDto(
value,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#weavingTimer() weavingTimer} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for weavingTimer
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withWeavingTimer(boolean value) {
if (this.weavingTimer == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
value,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#immediatePartialStoreThresholdSeconds() immediatePartialStoreThresholdSeconds} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for immediatePartialStoreThresholdSeconds
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withImmediatePartialStoreThresholdSeconds(int value) {
if (this.immediatePartialStoreThresholdSeconds == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
value,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateTransactionsPerType() maxAggregateTransactionsPerType} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for maxAggregateTransactionsPerType
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMaxAggregateTransactionsPerType(int value) {
if (this.maxAggregateTransactionsPerType == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
value,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateQueriesPerType() maxAggregateQueriesPerType} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for maxAggregateQueriesPerType
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMaxAggregateQueriesPerType(int value) {
if (this.maxAggregateQueriesPerType == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
value,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateServiceCallsPerType() maxAggregateServiceCallsPerType} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for maxAggregateServiceCallsPerType
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMaxAggregateServiceCallsPerType(int value) {
if (this.maxAggregateServiceCallsPerType == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
value,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#maxTraceEntriesPerTransaction() maxTraceEntriesPerTransaction} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for maxTraceEntriesPerTransaction
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMaxTraceEntriesPerTransaction(int value) {
if (this.maxTraceEntriesPerTransaction == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
value,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#maxStackTraceSamplesPerTransaction() maxStackTraceSamplesPerTransaction} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for maxStackTraceSamplesPerTransaction
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMaxStackTraceSamplesPerTransaction(int value) {
if (this.maxStackTraceSamplesPerTransaction == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
value,
this.mbeanGaugeNotFoundDelaySeconds,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#mbeanGaugeNotFoundDelaySeconds() mbeanGaugeNotFoundDelaySeconds} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for mbeanGaugeNotFoundDelaySeconds
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withMbeanGaugeNotFoundDelaySeconds(int value) {
if (this.mbeanGaugeNotFoundDelaySeconds == value) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
value,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link ConfigJsonService.AdvancedConfigDto#version() version} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for version
* @return A modified copy of the {@code this} object
*/
public final ImmutableAdvancedConfigDto withVersion(String value) {
if (this.version.equals(value)) return this;
return new ImmutableAdvancedConfigDto(
this.agentId,
this.weavingTimer,
this.immediatePartialStoreThresholdSeconds,
this.maxAggregateTransactionsPerType,
this.maxAggregateQueriesPerType,
this.maxAggregateServiceCallsPerType,
this.maxTraceEntriesPerTransaction,
this.maxStackTraceSamplesPerTransaction,
this.mbeanGaugeNotFoundDelaySeconds,
Preconditions.checkNotNull(value, "version"));
}
/**
* This instance is equal to all instances of {@code ImmutableAdvancedConfigDto} 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 ImmutableAdvancedConfigDto
&& equalTo((ImmutableAdvancedConfigDto) another);
}
private boolean equalTo(ImmutableAdvancedConfigDto another) {
return agentId.equals(another.agentId)
&& weavingTimer == another.weavingTimer
&& immediatePartialStoreThresholdSeconds == another.immediatePartialStoreThresholdSeconds
&& maxAggregateTransactionsPerType == another.maxAggregateTransactionsPerType
&& maxAggregateQueriesPerType == another.maxAggregateQueriesPerType
&& maxAggregateServiceCallsPerType == another.maxAggregateServiceCallsPerType
&& maxTraceEntriesPerTransaction == another.maxTraceEntriesPerTransaction
&& maxStackTraceSamplesPerTransaction == another.maxStackTraceSamplesPerTransaction
&& mbeanGaugeNotFoundDelaySeconds == another.mbeanGaugeNotFoundDelaySeconds
&& version.equals(another.version);
}
/**
* Computes a hash code from attributes: {@code agentId}, {@code weavingTimer}, {@code immediatePartialStoreThresholdSeconds}, {@code maxAggregateTransactionsPerType}, {@code maxAggregateQueriesPerType}, {@code maxAggregateServiceCallsPerType}, {@code maxTraceEntriesPerTransaction}, {@code maxStackTraceSamplesPerTransaction}, {@code mbeanGaugeNotFoundDelaySeconds}, {@code version}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 31;
h = h * 17 + agentId.hashCode();
h = h * 17 + Booleans.hashCode(weavingTimer);
h = h * 17 + immediatePartialStoreThresholdSeconds;
h = h * 17 + maxAggregateTransactionsPerType;
h = h * 17 + maxAggregateQueriesPerType;
h = h * 17 + maxAggregateServiceCallsPerType;
h = h * 17 + maxTraceEntriesPerTransaction;
h = h * 17 + maxStackTraceSamplesPerTransaction;
h = h * 17 + mbeanGaugeNotFoundDelaySeconds;
h = h * 17 + version.hashCode();
return h;
}
/**
* Prints the immutable value {@code AdvancedConfigDto...} with all non-generated
* and non-auxiliary attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("AdvancedConfigDto")
.add("agentId", agentId)
.add("weavingTimer", weavingTimer)
.add("immediatePartialStoreThresholdSeconds", immediatePartialStoreThresholdSeconds)
.add("maxAggregateTransactionsPerType", maxAggregateTransactionsPerType)
.add("maxAggregateQueriesPerType", maxAggregateQueriesPerType)
.add("maxAggregateServiceCallsPerType", maxAggregateServiceCallsPerType)
.add("maxTraceEntriesPerTransaction", maxTraceEntriesPerTransaction)
.add("maxStackTraceSamplesPerTransaction", maxStackTraceSamplesPerTransaction)
.add("mbeanGaugeNotFoundDelaySeconds", mbeanGaugeNotFoundDelaySeconds)
.add("version", version)
.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 extends ConfigJsonService.AdvancedConfigDto {
Optional agentId = Optional.absent();
@Nullable Boolean weavingTimer;
@Nullable Integer immediatePartialStoreThresholdSeconds;
@Nullable Integer maxAggregateTransactionsPerType;
@Nullable Integer maxAggregateQueriesPerType;
@Nullable Integer maxAggregateServiceCallsPerType;
@Nullable Integer maxTraceEntriesPerTransaction;
@Nullable Integer maxStackTraceSamplesPerTransaction;
@Nullable Integer mbeanGaugeNotFoundDelaySeconds;
@Nullable String version;
@JsonProperty
public void setAgentId(Optional agentId) {
this.agentId = agentId;
}
@JsonProperty
public void setWeavingTimer(boolean weavingTimer) {
this.weavingTimer = weavingTimer;
}
@JsonProperty
public void setImmediatePartialStoreThresholdSeconds(int immediatePartialStoreThresholdSeconds) {
this.immediatePartialStoreThresholdSeconds = immediatePartialStoreThresholdSeconds;
}
@JsonProperty
public void setMaxAggregateTransactionsPerType(int maxAggregateTransactionsPerType) {
this.maxAggregateTransactionsPerType = maxAggregateTransactionsPerType;
}
@JsonProperty
public void setMaxAggregateQueriesPerType(int maxAggregateQueriesPerType) {
this.maxAggregateQueriesPerType = maxAggregateQueriesPerType;
}
@JsonProperty
public void setMaxAggregateServiceCallsPerType(int maxAggregateServiceCallsPerType) {
this.maxAggregateServiceCallsPerType = maxAggregateServiceCallsPerType;
}
@JsonProperty
public void setMaxTraceEntriesPerTransaction(int maxTraceEntriesPerTransaction) {
this.maxTraceEntriesPerTransaction = maxTraceEntriesPerTransaction;
}
@JsonProperty
public void setMaxStackTraceSamplesPerTransaction(int maxStackTraceSamplesPerTransaction) {
this.maxStackTraceSamplesPerTransaction = maxStackTraceSamplesPerTransaction;
}
@JsonProperty
public void setMbeanGaugeNotFoundDelaySeconds(int mbeanGaugeNotFoundDelaySeconds) {
this.mbeanGaugeNotFoundDelaySeconds = mbeanGaugeNotFoundDelaySeconds;
}
@JsonProperty
public void setVersion(String version) {
this.version = version;
}
@Override
Optional agentId() { throw new UnsupportedOperationException(); }
@Override
boolean weavingTimer() { throw new UnsupportedOperationException(); }
@Override
int immediatePartialStoreThresholdSeconds() { throw new UnsupportedOperationException(); }
@Override
int maxAggregateTransactionsPerType() { throw new UnsupportedOperationException(); }
@Override
int maxAggregateQueriesPerType() { throw new UnsupportedOperationException(); }
@Override
int maxAggregateServiceCallsPerType() { throw new UnsupportedOperationException(); }
@Override
int maxTraceEntriesPerTransaction() { throw new UnsupportedOperationException(); }
@Override
int maxStackTraceSamplesPerTransaction() { throw new UnsupportedOperationException(); }
@Override
int mbeanGaugeNotFoundDelaySeconds() { throw new UnsupportedOperationException(); }
@Override
String version() { 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 ImmutableAdvancedConfigDto fromJson(Json json) {
ImmutableAdvancedConfigDto.Builder builder = ImmutableAdvancedConfigDto.builder();
if (json.agentId != null) {
builder.agentId(json.agentId);
}
if (json.weavingTimer != null) {
builder.weavingTimer(json.weavingTimer);
}
if (json.immediatePartialStoreThresholdSeconds != null) {
builder.immediatePartialStoreThresholdSeconds(json.immediatePartialStoreThresholdSeconds);
}
if (json.maxAggregateTransactionsPerType != null) {
builder.maxAggregateTransactionsPerType(json.maxAggregateTransactionsPerType);
}
if (json.maxAggregateQueriesPerType != null) {
builder.maxAggregateQueriesPerType(json.maxAggregateQueriesPerType);
}
if (json.maxAggregateServiceCallsPerType != null) {
builder.maxAggregateServiceCallsPerType(json.maxAggregateServiceCallsPerType);
}
if (json.maxTraceEntriesPerTransaction != null) {
builder.maxTraceEntriesPerTransaction(json.maxTraceEntriesPerTransaction);
}
if (json.maxStackTraceSamplesPerTransaction != null) {
builder.maxStackTraceSamplesPerTransaction(json.maxStackTraceSamplesPerTransaction);
}
if (json.mbeanGaugeNotFoundDelaySeconds != null) {
builder.mbeanGaugeNotFoundDelaySeconds(json.mbeanGaugeNotFoundDelaySeconds);
}
if (json.version != null) {
builder.version(json.version);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link ConfigJsonService.AdvancedConfigDto} 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 AdvancedConfigDto instance
*/
public static ImmutableAdvancedConfigDto copyOf(ConfigJsonService.AdvancedConfigDto instance) {
if (instance instanceof ImmutableAdvancedConfigDto) {
return (ImmutableAdvancedConfigDto) instance;
}
return ImmutableAdvancedConfigDto.builder()
.copyFrom(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableAdvancedConfigDto ImmutableAdvancedConfigDto}.
* @return A new ImmutableAdvancedConfigDto builder
*/
public static ImmutableAdvancedConfigDto.Builder builder() {
return new ImmutableAdvancedConfigDto.Builder();
}
/**
* Builds instances of type {@link ImmutableAdvancedConfigDto ImmutableAdvancedConfigDto}.
* 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_WEAVING_TIMER = 0x1L;
private static final long INIT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS = 0x2L;
private static final long INIT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TYPE = 0x4L;
private static final long INIT_BIT_MAX_AGGREGATE_QUERIES_PER_TYPE = 0x8L;
private static final long INIT_BIT_MAX_AGGREGATE_SERVICE_CALLS_PER_TYPE = 0x10L;
private static final long INIT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION = 0x20L;
private static final long INIT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION = 0x40L;
private static final long INIT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS = 0x80L;
private static final long INIT_BIT_VERSION = 0x100L;
private long initBits = 0x1ff;
private Optional agentId = Optional.absent();
private boolean weavingTimer;
private int immediatePartialStoreThresholdSeconds;
private int maxAggregateTransactionsPerType;
private int maxAggregateQueriesPerType;
private int maxAggregateServiceCallsPerType;
private int maxTraceEntriesPerTransaction;
private int maxStackTraceSamplesPerTransaction;
private int mbeanGaugeNotFoundDelaySeconds;
private @Nullable String version;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code AdvancedConfigDto} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder copyFrom(ConfigJsonService.AdvancedConfigDto instance) {
Preconditions.checkNotNull(instance, "instance");
Optional agentIdOptional = instance.agentId();
if (agentIdOptional.isPresent()) {
agentId(agentIdOptional);
}
weavingTimer(instance.weavingTimer());
immediatePartialStoreThresholdSeconds(instance.immediatePartialStoreThresholdSeconds());
maxAggregateTransactionsPerType(instance.maxAggregateTransactionsPerType());
maxAggregateQueriesPerType(instance.maxAggregateQueriesPerType());
maxAggregateServiceCallsPerType(instance.maxAggregateServiceCallsPerType());
maxTraceEntriesPerTransaction(instance.maxTraceEntriesPerTransaction());
maxStackTraceSamplesPerTransaction(instance.maxStackTraceSamplesPerTransaction());
mbeanGaugeNotFoundDelaySeconds(instance.mbeanGaugeNotFoundDelaySeconds());
version(instance.version());
return this;
}
/**
* Initializes the optional value {@link ConfigJsonService.AdvancedConfigDto#agentId() agentId} to agentId.
* @param agentId The value for agentId
* @return {@code this} builder for chained invocation
*/
public final Builder agentId(String agentId) {
this.agentId = Optional.of(agentId);
return this;
}
/**
* Initializes the optional value {@link ConfigJsonService.AdvancedConfigDto#agentId() agentId} to agentId.
* @param agentId The value for agentId
* @return {@code this} builder for use in a chained invocation
*/
public final Builder agentId(Optional agentId) {
this.agentId = Preconditions.checkNotNull(agentId, "agentId");
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#weavingTimer() weavingTimer} attribute.
* @param weavingTimer The value for weavingTimer
* @return {@code this} builder for use in a chained invocation
*/
public final Builder weavingTimer(boolean weavingTimer) {
this.weavingTimer = weavingTimer;
initBits &= ~INIT_BIT_WEAVING_TIMER;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#immediatePartialStoreThresholdSeconds() immediatePartialStoreThresholdSeconds} attribute.
* @param immediatePartialStoreThresholdSeconds The value for immediatePartialStoreThresholdSeconds
* @return {@code this} builder for use in a chained invocation
*/
public final Builder immediatePartialStoreThresholdSeconds(int immediatePartialStoreThresholdSeconds) {
this.immediatePartialStoreThresholdSeconds = immediatePartialStoreThresholdSeconds;
initBits &= ~INIT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateTransactionsPerType() maxAggregateTransactionsPerType} attribute.
* @param maxAggregateTransactionsPerType The value for maxAggregateTransactionsPerType
* @return {@code this} builder for use in a chained invocation
*/
public final Builder maxAggregateTransactionsPerType(int maxAggregateTransactionsPerType) {
this.maxAggregateTransactionsPerType = maxAggregateTransactionsPerType;
initBits &= ~INIT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TYPE;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateQueriesPerType() maxAggregateQueriesPerType} attribute.
* @param maxAggregateQueriesPerType The value for maxAggregateQueriesPerType
* @return {@code this} builder for use in a chained invocation
*/
public final Builder maxAggregateQueriesPerType(int maxAggregateQueriesPerType) {
this.maxAggregateQueriesPerType = maxAggregateQueriesPerType;
initBits &= ~INIT_BIT_MAX_AGGREGATE_QUERIES_PER_TYPE;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#maxAggregateServiceCallsPerType() maxAggregateServiceCallsPerType} attribute.
* @param maxAggregateServiceCallsPerType The value for maxAggregateServiceCallsPerType
* @return {@code this} builder for use in a chained invocation
*/
public final Builder maxAggregateServiceCallsPerType(int maxAggregateServiceCallsPerType) {
this.maxAggregateServiceCallsPerType = maxAggregateServiceCallsPerType;
initBits &= ~INIT_BIT_MAX_AGGREGATE_SERVICE_CALLS_PER_TYPE;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#maxTraceEntriesPerTransaction() maxTraceEntriesPerTransaction} attribute.
* @param maxTraceEntriesPerTransaction The value for maxTraceEntriesPerTransaction
* @return {@code this} builder for use in a chained invocation
*/
public final Builder maxTraceEntriesPerTransaction(int maxTraceEntriesPerTransaction) {
this.maxTraceEntriesPerTransaction = maxTraceEntriesPerTransaction;
initBits &= ~INIT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#maxStackTraceSamplesPerTransaction() maxStackTraceSamplesPerTransaction} attribute.
* @param maxStackTraceSamplesPerTransaction The value for maxStackTraceSamplesPerTransaction
* @return {@code this} builder for use in a chained invocation
*/
public final Builder maxStackTraceSamplesPerTransaction(int maxStackTraceSamplesPerTransaction) {
this.maxStackTraceSamplesPerTransaction = maxStackTraceSamplesPerTransaction;
initBits &= ~INIT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#mbeanGaugeNotFoundDelaySeconds() mbeanGaugeNotFoundDelaySeconds} attribute.
* @param mbeanGaugeNotFoundDelaySeconds The value for mbeanGaugeNotFoundDelaySeconds
* @return {@code this} builder for use in a chained invocation
*/
public final Builder mbeanGaugeNotFoundDelaySeconds(int mbeanGaugeNotFoundDelaySeconds) {
this.mbeanGaugeNotFoundDelaySeconds = mbeanGaugeNotFoundDelaySeconds;
initBits &= ~INIT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS;
return this;
}
/**
* Initializes the value for the {@link ConfigJsonService.AdvancedConfigDto#version() version} attribute.
* @param version The value for version
* @return {@code this} builder for use in a chained invocation
*/
public final Builder version(String version) {
this.version = Preconditions.checkNotNull(version, "version");
initBits &= ~INIT_BIT_VERSION;
return this;
}
/**
* Builds a new {@link ImmutableAdvancedConfigDto ImmutableAdvancedConfigDto}.
* @return An immutable instance of AdvancedConfigDto
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableAdvancedConfigDto build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableAdvancedConfigDto(
agentId,
weavingTimer,
immediatePartialStoreThresholdSeconds,
maxAggregateTransactionsPerType,
maxAggregateQueriesPerType,
maxAggregateServiceCallsPerType,
maxTraceEntriesPerTransaction,
maxStackTraceSamplesPerTransaction,
mbeanGaugeNotFoundDelaySeconds,
version);
}
private String formatRequiredAttributesMessage() {
List attributes = Lists.newArrayList();
if ((initBits & INIT_BIT_WEAVING_TIMER) != 0) attributes.add("weavingTimer");
if ((initBits & INIT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS) != 0) attributes.add("immediatePartialStoreThresholdSeconds");
if ((initBits & INIT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TYPE) != 0) attributes.add("maxAggregateTransactionsPerType");
if ((initBits & INIT_BIT_MAX_AGGREGATE_QUERIES_PER_TYPE) != 0) attributes.add("maxAggregateQueriesPerType");
if ((initBits & INIT_BIT_MAX_AGGREGATE_SERVICE_CALLS_PER_TYPE) != 0) attributes.add("maxAggregateServiceCallsPerType");
if ((initBits & INIT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION) != 0) attributes.add("maxTraceEntriesPerTransaction");
if ((initBits & INIT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION) != 0) attributes.add("maxStackTraceSamplesPerTransaction");
if ((initBits & INIT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS) != 0) attributes.add("mbeanGaugeNotFoundDelaySeconds");
if ((initBits & INIT_BIT_VERSION) != 0) attributes.add("version");
return "Cannot build AdvancedConfigDto, some of required attributes are not set " + attributes;
}
}
}