
org.glowroot.agent.config.ImmutableInstrumentationConfig Maven / Gradle / Ivy
Show all versions of glowroot-agent-it-harness Show documentation
package org.glowroot.agent.config;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonIgnore;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonInclude;
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.ImmutableMap;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.glowroot.agent.shaded.google.common.primitives.Booleans;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.glowroot.agent.shaded.glowroot.wire.api.model.AgentConfigOuterClass;
/**
* Immutable implementation of {@link InstrumentationConfig}.
*
* Use the builder to create immutable instances:
* {@code ImmutableInstrumentationConfig.builder()}.
*/
@SuppressWarnings("all")
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "InstrumentationConfig"})
@Immutable
public final class ImmutableInstrumentationConfig extends InstrumentationConfig {
private final String className;
private final String classAnnotation;
private final String methodDeclaringClassName;
private final String methodName;
private final String methodAnnotation;
private final ImmutableList methodParameterTypes;
private final String methodReturnType;
private final ImmutableList methodModifiers;
private final String nestingGroup;
private final int priority;
private final AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind;
private final String transactionType;
private final String transactionNameTemplate;
private final String transactionUserTemplate;
private final ImmutableMap transactionAttributeTemplates;
private final @Nullable Integer transactionSlowThresholdMillis;
private final String traceEntryMessageTemplate;
private final @Nullable Integer traceEntryStackThresholdMillis;
private final boolean traceEntryCaptureSelfNested;
private final String timerName;
private final String enabledProperty;
private final String traceEntryEnabledProperty;
private final boolean isTimerOrGreater;
private final boolean isTraceEntryOrGreater;
private final boolean isTransaction;
private final ImmutableList validationErrors;
private ImmutableInstrumentationConfig(ImmutableInstrumentationConfig.Builder builder) {
this.methodParameterTypes = builder.methodParameterTypesBuilder.build();
this.methodModifiers = builder.methodModifiersBuilder.build();
this.captureKind = builder.captureKind;
this.transactionAttributeTemplates = builder.transactionAttributeTemplatesBuilder.build();
this.transactionSlowThresholdMillis = builder.transactionSlowThresholdMillis;
this.traceEntryStackThresholdMillis = builder.traceEntryStackThresholdMillis;
if (builder.className != null) {
initShim.className(builder.className);
}
if (builder.classAnnotation != null) {
initShim.classAnnotation(builder.classAnnotation);
}
if (builder.methodDeclaringClassName != null) {
initShim.methodDeclaringClassName(builder.methodDeclaringClassName);
}
if (builder.methodName != null) {
initShim.methodName(builder.methodName);
}
if (builder.methodAnnotation != null) {
initShim.methodAnnotation(builder.methodAnnotation);
}
if (builder.methodReturnType != null) {
initShim.methodReturnType(builder.methodReturnType);
}
if (builder.nestingGroup != null) {
initShim.nestingGroup(builder.nestingGroup);
}
if (builder.priorityIsSet()) {
initShim.priority(builder.priority);
}
if (builder.transactionType != null) {
initShim.transactionType(builder.transactionType);
}
if (builder.transactionNameTemplate != null) {
initShim.transactionNameTemplate(builder.transactionNameTemplate);
}
if (builder.transactionUserTemplate != null) {
initShim.transactionUserTemplate(builder.transactionUserTemplate);
}
if (builder.traceEntryMessageTemplate != null) {
initShim.traceEntryMessageTemplate(builder.traceEntryMessageTemplate);
}
if (builder.traceEntryCaptureSelfNestedIsSet()) {
initShim.traceEntryCaptureSelfNested(builder.traceEntryCaptureSelfNested);
}
if (builder.timerName != null) {
initShim.timerName(builder.timerName);
}
if (builder.enabledProperty != null) {
initShim.enabledProperty(builder.enabledProperty);
}
if (builder.traceEntryEnabledProperty != null) {
initShim.traceEntryEnabledProperty(builder.traceEntryEnabledProperty);
}
this.className = initShim.className();
this.classAnnotation = initShim.classAnnotation();
this.methodDeclaringClassName = initShim.methodDeclaringClassName();
this.methodName = initShim.methodName();
this.methodAnnotation = initShim.methodAnnotation();
this.methodReturnType = initShim.methodReturnType();
this.nestingGroup = initShim.nestingGroup();
this.priority = initShim.priority();
this.transactionType = initShim.transactionType();
this.transactionNameTemplate = initShim.transactionNameTemplate();
this.transactionUserTemplate = initShim.transactionUserTemplate();
this.traceEntryMessageTemplate = initShim.traceEntryMessageTemplate();
this.traceEntryCaptureSelfNested = initShim.traceEntryCaptureSelfNested();
this.timerName = initShim.timerName();
this.enabledProperty = initShim.enabledProperty();
this.traceEntryEnabledProperty = initShim.traceEntryEnabledProperty();
this.isTimerOrGreater = initShim.isTimerOrGreater();
this.isTraceEntryOrGreater = initShim.isTraceEntryOrGreater();
this.isTransaction = initShim.isTransaction();
this.validationErrors = initShim.validationErrors();
this.initShim = null;
}
private ImmutableInstrumentationConfig(
String className,
String classAnnotation,
String methodDeclaringClassName,
String methodName,
String methodAnnotation,
ImmutableList methodParameterTypes,
String methodReturnType,
ImmutableList methodModifiers,
String nestingGroup,
int priority,
AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind,
String transactionType,
String transactionNameTemplate,
String transactionUserTemplate,
ImmutableMap transactionAttributeTemplates,
@Nullable Integer transactionSlowThresholdMillis,
String traceEntryMessageTemplate,
@Nullable Integer traceEntryStackThresholdMillis,
boolean traceEntryCaptureSelfNested,
String timerName,
String enabledProperty,
String traceEntryEnabledProperty) {
this.className = className;
this.classAnnotation = classAnnotation;
this.methodDeclaringClassName = methodDeclaringClassName;
this.methodName = methodName;
this.methodAnnotation = methodAnnotation;
this.methodParameterTypes = methodParameterTypes;
this.methodReturnType = methodReturnType;
this.methodModifiers = methodModifiers;
this.nestingGroup = nestingGroup;
this.priority = priority;
this.captureKind = captureKind;
this.transactionType = transactionType;
this.transactionNameTemplate = transactionNameTemplate;
this.transactionUserTemplate = transactionUserTemplate;
this.transactionAttributeTemplates = transactionAttributeTemplates;
this.transactionSlowThresholdMillis = transactionSlowThresholdMillis;
this.traceEntryMessageTemplate = traceEntryMessageTemplate;
this.traceEntryStackThresholdMillis = traceEntryStackThresholdMillis;
this.traceEntryCaptureSelfNested = traceEntryCaptureSelfNested;
this.timerName = timerName;
this.enabledProperty = enabledProperty;
this.traceEntryEnabledProperty = traceEntryEnabledProperty;
initShim.className(className);
initShim.classAnnotation(classAnnotation);
initShim.methodDeclaringClassName(methodDeclaringClassName);
initShim.methodName(methodName);
initShim.methodAnnotation(methodAnnotation);
initShim.methodReturnType(methodReturnType);
initShim.nestingGroup(nestingGroup);
initShim.priority(priority);
initShim.transactionType(transactionType);
initShim.transactionNameTemplate(transactionNameTemplate);
initShim.transactionUserTemplate(transactionUserTemplate);
initShim.traceEntryMessageTemplate(traceEntryMessageTemplate);
initShim.traceEntryCaptureSelfNested(traceEntryCaptureSelfNested);
initShim.timerName(timerName);
initShim.enabledProperty(enabledProperty);
initShim.traceEntryEnabledProperty(traceEntryEnabledProperty);
this.isTimerOrGreater = initShim.isTimerOrGreater();
this.isTraceEntryOrGreater = initShim.isTraceEntryOrGreater();
this.isTransaction = initShim.isTransaction();
this.validationErrors = initShim.validationErrors();
this.initShim = null;
}
private static final int STAGE_INITIALIZING = -1;
private static final int STAGE_UNINITIALIZED = 0;
private static final int STAGE_INITIALIZED = 1;
private volatile InitShim initShim = new InitShim();
private final class InitShim {
private String className;
private byte classNameStage;
String className() {
if (classNameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (classNameStage == STAGE_UNINITIALIZED) {
classNameStage = STAGE_INITIALIZING;
this.className = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.className(), "className");
classNameStage = STAGE_INITIALIZED;
}
return className;
}
String className(String value) {
this.className = value;
classNameStage = STAGE_INITIALIZED;
return value;
}
private String classAnnotation;
private byte classAnnotationStage;
String classAnnotation() {
if (classAnnotationStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (classAnnotationStage == STAGE_UNINITIALIZED) {
classAnnotationStage = STAGE_INITIALIZING;
this.classAnnotation = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.classAnnotation(), "classAnnotation");
classAnnotationStage = STAGE_INITIALIZED;
}
return classAnnotation;
}
String classAnnotation(String value) {
this.classAnnotation = value;
classAnnotationStage = STAGE_INITIALIZED;
return value;
}
private String methodDeclaringClassName;
private byte methodDeclaringClassNameStage;
String methodDeclaringClassName() {
if (methodDeclaringClassNameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (methodDeclaringClassNameStage == STAGE_UNINITIALIZED) {
methodDeclaringClassNameStage = STAGE_INITIALIZING;
this.methodDeclaringClassName = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.methodDeclaringClassName(), "methodDeclaringClassName");
methodDeclaringClassNameStage = STAGE_INITIALIZED;
}
return methodDeclaringClassName;
}
String methodDeclaringClassName(String value) {
this.methodDeclaringClassName = value;
methodDeclaringClassNameStage = STAGE_INITIALIZED;
return value;
}
private String methodName;
private byte methodNameStage;
String methodName() {
if (methodNameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (methodNameStage == STAGE_UNINITIALIZED) {
methodNameStage = STAGE_INITIALIZING;
this.methodName = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.methodName(), "methodName");
methodNameStage = STAGE_INITIALIZED;
}
return methodName;
}
String methodName(String value) {
this.methodName = value;
methodNameStage = STAGE_INITIALIZED;
return value;
}
private String methodAnnotation;
private byte methodAnnotationStage;
String methodAnnotation() {
if (methodAnnotationStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (methodAnnotationStage == STAGE_UNINITIALIZED) {
methodAnnotationStage = STAGE_INITIALIZING;
this.methodAnnotation = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.methodAnnotation(), "methodAnnotation");
methodAnnotationStage = STAGE_INITIALIZED;
}
return methodAnnotation;
}
String methodAnnotation(String value) {
this.methodAnnotation = value;
methodAnnotationStage = STAGE_INITIALIZED;
return value;
}
private String methodReturnType;
private byte methodReturnTypeStage;
String methodReturnType() {
if (methodReturnTypeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (methodReturnTypeStage == STAGE_UNINITIALIZED) {
methodReturnTypeStage = STAGE_INITIALIZING;
this.methodReturnType = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.methodReturnType(), "methodReturnType");
methodReturnTypeStage = STAGE_INITIALIZED;
}
return methodReturnType;
}
String methodReturnType(String value) {
this.methodReturnType = value;
methodReturnTypeStage = STAGE_INITIALIZED;
return value;
}
private String nestingGroup;
private byte nestingGroupStage;
String nestingGroup() {
if (nestingGroupStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (nestingGroupStage == STAGE_UNINITIALIZED) {
nestingGroupStage = STAGE_INITIALIZING;
this.nestingGroup = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.nestingGroup(), "nestingGroup");
nestingGroupStage = STAGE_INITIALIZED;
}
return nestingGroup;
}
String nestingGroup(String value) {
this.nestingGroup = value;
nestingGroupStage = STAGE_INITIALIZED;
return value;
}
private int priority;
private byte priorityStage;
int priority() {
if (priorityStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (priorityStage == STAGE_UNINITIALIZED) {
priorityStage = STAGE_INITIALIZING;
this.priority = ImmutableInstrumentationConfig.super.priority();
priorityStage = STAGE_INITIALIZED;
}
return priority;
}
int priority(int value) {
this.priority = value;
priorityStage = STAGE_INITIALIZED;
return value;
}
private String transactionType;
private byte transactionTypeStage;
String transactionType() {
if (transactionTypeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (transactionTypeStage == STAGE_UNINITIALIZED) {
transactionTypeStage = STAGE_INITIALIZING;
this.transactionType = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.transactionType(), "transactionType");
transactionTypeStage = STAGE_INITIALIZED;
}
return transactionType;
}
String transactionType(String value) {
this.transactionType = value;
transactionTypeStage = STAGE_INITIALIZED;
return value;
}
private String transactionNameTemplate;
private byte transactionNameTemplateStage;
String transactionNameTemplate() {
if (transactionNameTemplateStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (transactionNameTemplateStage == STAGE_UNINITIALIZED) {
transactionNameTemplateStage = STAGE_INITIALIZING;
this.transactionNameTemplate = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.transactionNameTemplate(), "transactionNameTemplate");
transactionNameTemplateStage = STAGE_INITIALIZED;
}
return transactionNameTemplate;
}
String transactionNameTemplate(String value) {
this.transactionNameTemplate = value;
transactionNameTemplateStage = STAGE_INITIALIZED;
return value;
}
private String transactionUserTemplate;
private byte transactionUserTemplateStage;
String transactionUserTemplate() {
if (transactionUserTemplateStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (transactionUserTemplateStage == STAGE_UNINITIALIZED) {
transactionUserTemplateStage = STAGE_INITIALIZING;
this.transactionUserTemplate = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.transactionUserTemplate(), "transactionUserTemplate");
transactionUserTemplateStage = STAGE_INITIALIZED;
}
return transactionUserTemplate;
}
String transactionUserTemplate(String value) {
this.transactionUserTemplate = value;
transactionUserTemplateStage = STAGE_INITIALIZED;
return value;
}
private String traceEntryMessageTemplate;
private byte traceEntryMessageTemplateStage;
String traceEntryMessageTemplate() {
if (traceEntryMessageTemplateStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (traceEntryMessageTemplateStage == STAGE_UNINITIALIZED) {
traceEntryMessageTemplateStage = STAGE_INITIALIZING;
this.traceEntryMessageTemplate = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.traceEntryMessageTemplate(), "traceEntryMessageTemplate");
traceEntryMessageTemplateStage = STAGE_INITIALIZED;
}
return traceEntryMessageTemplate;
}
String traceEntryMessageTemplate(String value) {
this.traceEntryMessageTemplate = value;
traceEntryMessageTemplateStage = STAGE_INITIALIZED;
return value;
}
private boolean traceEntryCaptureSelfNested;
private byte traceEntryCaptureSelfNestedStage;
boolean traceEntryCaptureSelfNested() {
if (traceEntryCaptureSelfNestedStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (traceEntryCaptureSelfNestedStage == STAGE_UNINITIALIZED) {
traceEntryCaptureSelfNestedStage = STAGE_INITIALIZING;
this.traceEntryCaptureSelfNested = ImmutableInstrumentationConfig.super.traceEntryCaptureSelfNested();
traceEntryCaptureSelfNestedStage = STAGE_INITIALIZED;
}
return traceEntryCaptureSelfNested;
}
boolean traceEntryCaptureSelfNested(boolean value) {
this.traceEntryCaptureSelfNested = value;
traceEntryCaptureSelfNestedStage = STAGE_INITIALIZED;
return value;
}
private String timerName;
private byte timerNameStage;
String timerName() {
if (timerNameStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (timerNameStage == STAGE_UNINITIALIZED) {
timerNameStage = STAGE_INITIALIZING;
this.timerName = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.timerName(), "timerName");
timerNameStage = STAGE_INITIALIZED;
}
return timerName;
}
String timerName(String value) {
this.timerName = value;
timerNameStage = STAGE_INITIALIZED;
return value;
}
private String enabledProperty;
private byte enabledPropertyStage;
String enabledProperty() {
if (enabledPropertyStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (enabledPropertyStage == STAGE_UNINITIALIZED) {
enabledPropertyStage = STAGE_INITIALIZING;
this.enabledProperty = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.enabledProperty(), "enabledProperty");
enabledPropertyStage = STAGE_INITIALIZED;
}
return enabledProperty;
}
String enabledProperty(String value) {
this.enabledProperty = value;
enabledPropertyStage = STAGE_INITIALIZED;
return value;
}
private String traceEntryEnabledProperty;
private byte traceEntryEnabledPropertyStage;
String traceEntryEnabledProperty() {
if (traceEntryEnabledPropertyStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (traceEntryEnabledPropertyStage == STAGE_UNINITIALIZED) {
traceEntryEnabledPropertyStage = STAGE_INITIALIZING;
this.traceEntryEnabledProperty = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.traceEntryEnabledProperty(), "traceEntryEnabledProperty");
traceEntryEnabledPropertyStage = STAGE_INITIALIZED;
}
return traceEntryEnabledProperty;
}
String traceEntryEnabledProperty(String value) {
this.traceEntryEnabledProperty = value;
traceEntryEnabledPropertyStage = STAGE_INITIALIZED;
return value;
}
private boolean isTimerOrGreater;
private byte isTimerOrGreaterStage;
boolean isTimerOrGreater() {
if (isTimerOrGreaterStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (isTimerOrGreaterStage == STAGE_UNINITIALIZED) {
isTimerOrGreaterStage = STAGE_INITIALIZING;
this.isTimerOrGreater = ImmutableInstrumentationConfig.super.isTimerOrGreater();
isTimerOrGreaterStage = STAGE_INITIALIZED;
}
return isTimerOrGreater;
}
private boolean isTraceEntryOrGreater;
private byte isTraceEntryOrGreaterStage;
boolean isTraceEntryOrGreater() {
if (isTraceEntryOrGreaterStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (isTraceEntryOrGreaterStage == STAGE_UNINITIALIZED) {
isTraceEntryOrGreaterStage = STAGE_INITIALIZING;
this.isTraceEntryOrGreater = ImmutableInstrumentationConfig.super.isTraceEntryOrGreater();
isTraceEntryOrGreaterStage = STAGE_INITIALIZED;
}
return isTraceEntryOrGreater;
}
private boolean isTransaction;
private byte isTransactionStage;
boolean isTransaction() {
if (isTransactionStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (isTransactionStage == STAGE_UNINITIALIZED) {
isTransactionStage = STAGE_INITIALIZING;
this.isTransaction = ImmutableInstrumentationConfig.super.isTransaction();
isTransactionStage = STAGE_INITIALIZED;
}
return isTransaction;
}
private ImmutableList validationErrors;
private byte validationErrorsStage;
ImmutableList validationErrors() {
if (validationErrorsStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (validationErrorsStage == STAGE_UNINITIALIZED) {
validationErrorsStage = STAGE_INITIALIZING;
this.validationErrors = Preconditions.checkNotNull(ImmutableInstrumentationConfig.super.validationErrors(), "validationErrors");
validationErrorsStage = STAGE_INITIALIZED;
}
return validationErrors;
}
private String formatInitCycleMessage() {
ArrayList attributes = Lists.newArrayList();
if (classNameStage == STAGE_INITIALIZING) attributes.add("className");
if (classAnnotationStage == STAGE_INITIALIZING) attributes.add("classAnnotation");
if (methodDeclaringClassNameStage == STAGE_INITIALIZING) attributes.add("methodDeclaringClassName");
if (methodNameStage == STAGE_INITIALIZING) attributes.add("methodName");
if (methodAnnotationStage == STAGE_INITIALIZING) attributes.add("methodAnnotation");
if (methodReturnTypeStage == STAGE_INITIALIZING) attributes.add("methodReturnType");
if (nestingGroupStage == STAGE_INITIALIZING) attributes.add("nestingGroup");
if (priorityStage == STAGE_INITIALIZING) attributes.add("priority");
if (transactionTypeStage == STAGE_INITIALIZING) attributes.add("transactionType");
if (transactionNameTemplateStage == STAGE_INITIALIZING) attributes.add("transactionNameTemplate");
if (transactionUserTemplateStage == STAGE_INITIALIZING) attributes.add("transactionUserTemplate");
if (traceEntryMessageTemplateStage == STAGE_INITIALIZING) attributes.add("traceEntryMessageTemplate");
if (traceEntryCaptureSelfNestedStage == STAGE_INITIALIZING) attributes.add("traceEntryCaptureSelfNested");
if (timerNameStage == STAGE_INITIALIZING) attributes.add("timerName");
if (enabledPropertyStage == STAGE_INITIALIZING) attributes.add("enabledProperty");
if (traceEntryEnabledPropertyStage == STAGE_INITIALIZING) attributes.add("traceEntryEnabledProperty");
if (isTimerOrGreaterStage == STAGE_INITIALIZING) attributes.add("isTimerOrGreater");
if (isTraceEntryOrGreaterStage == STAGE_INITIALIZING) attributes.add("isTraceEntryOrGreater");
if (isTransactionStage == STAGE_INITIALIZING) attributes.add("isTransaction");
if (validationErrorsStage == STAGE_INITIALIZING) attributes.add("validationErrors");
return "Cannot build InstrumentationConfig, attribute initializers form cycle" + attributes;
}
}
/**
* @return The value of the {@code className} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String className() {
return initShim != null
? initShim.className()
: className;
}
/**
* @return The value of the {@code classAnnotation} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String classAnnotation() {
return initShim != null
? initShim.classAnnotation()
: classAnnotation;
}
/**
* @return The value of the {@code methodDeclaringClassName} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String methodDeclaringClassName() {
return initShim != null
? initShim.methodDeclaringClassName()
: methodDeclaringClassName;
}
/**
* @return The value of the {@code methodName} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String methodName() {
return initShim != null
? initShim.methodName()
: methodName;
}
/**
* @return The value of the {@code methodAnnotation} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String methodAnnotation() {
return initShim != null
? initShim.methodAnnotation()
: methodAnnotation;
}
/**
* @return The value of the {@code methodParameterTypes} attribute
*/
@JsonProperty
@Override
public ImmutableList methodParameterTypes() {
return methodParameterTypes;
}
/**
* @return The value of the {@code methodReturnType} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String methodReturnType() {
return initShim != null
? initShim.methodReturnType()
: methodReturnType;
}
/**
* @return The value of the {@code methodModifiers} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public ImmutableList methodModifiers() {
return methodModifiers;
}
/**
* @return The value of the {@code nestingGroup} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String nestingGroup() {
return initShim != null
? initShim.nestingGroup()
: nestingGroup;
}
/**
* @return The value of the {@code priority} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public int priority() {
return initShim != null
? initShim.priority()
: priority;
}
/**
* @return The value of the {@code captureKind} attribute
*/
@JsonProperty
@Override
public AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind() {
return captureKind;
}
/**
* @return The value of the {@code transactionType} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String transactionType() {
return initShim != null
? initShim.transactionType()
: transactionType;
}
/**
* @return The value of the {@code transactionNameTemplate} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String transactionNameTemplate() {
return initShim != null
? initShim.transactionNameTemplate()
: transactionNameTemplate;
}
/**
* @return The value of the {@code transactionUserTemplate} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String transactionUserTemplate() {
return initShim != null
? initShim.transactionUserTemplate()
: transactionUserTemplate;
}
/**
* @return The value of the {@code transactionAttributeTemplates} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public ImmutableMap transactionAttributeTemplates() {
return transactionAttributeTemplates;
}
/**
* @return The value of the {@code transactionSlowThresholdMillis} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Override
public @Nullable Integer transactionSlowThresholdMillis() {
return transactionSlowThresholdMillis;
}
/**
* @return The value of the {@code traceEntryMessageTemplate} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String traceEntryMessageTemplate() {
return initShim != null
? initShim.traceEntryMessageTemplate()
: traceEntryMessageTemplate;
}
/**
* @return The value of the {@code traceEntryStackThresholdMillis} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Override
public @Nullable Integer traceEntryStackThresholdMillis() {
return traceEntryStackThresholdMillis;
}
/**
* @return The value of the {@code traceEntryCaptureSelfNested} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public boolean traceEntryCaptureSelfNested() {
return initShim != null
? initShim.traceEntryCaptureSelfNested()
: traceEntryCaptureSelfNested;
}
/**
* @return The value of the {@code timerName} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String timerName() {
return initShim != null
? initShim.timerName()
: timerName;
}
/**
* @return The value of the {@code enabledProperty} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String enabledProperty() {
return initShim != null
? initShim.enabledProperty()
: enabledProperty;
}
/**
* @return The value of the {@code traceEntryEnabledProperty} attribute
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@Override
public String traceEntryEnabledProperty() {
return initShim != null
? initShim.traceEntryEnabledProperty()
: traceEntryEnabledProperty;
}
/**
* @return The computed-at-construction value of the {@code isTimerOrGreater} attribute
*/
@JsonProperty
@JsonIgnore
@Override
public boolean isTimerOrGreater() {
return initShim != null
? initShim.isTimerOrGreater()
: isTimerOrGreater;
}
/**
* @return The computed-at-construction value of the {@code isTraceEntryOrGreater} attribute
*/
@JsonProperty
@JsonIgnore
@Override
public boolean isTraceEntryOrGreater() {
return initShim != null
? initShim.isTraceEntryOrGreater()
: isTraceEntryOrGreater;
}
/**
* @return The computed-at-construction value of the {@code isTransaction} attribute
*/
@JsonProperty
@JsonIgnore
@Override
public boolean isTransaction() {
return initShim != null
? initShim.isTransaction()
: isTransaction;
}
/**
* @return The computed-at-construction value of the {@code validationErrors} attribute
*/
@JsonProperty
@JsonIgnore
@Override
public ImmutableList validationErrors() {
return initShim != null
? initShim.validationErrors()
: validationErrors;
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#className() className} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for className
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withClassName(String value) {
if (this.className.equals(value)) return this;
return new ImmutableInstrumentationConfig(
Preconditions.checkNotNull(value, "className"),
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#classAnnotation() classAnnotation} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for classAnnotation
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withClassAnnotation(String value) {
if (this.classAnnotation.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
Preconditions.checkNotNull(value, "classAnnotation"),
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#methodDeclaringClassName() methodDeclaringClassName} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for methodDeclaringClassName
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodDeclaringClassName(String value) {
if (this.methodDeclaringClassName.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
Preconditions.checkNotNull(value, "methodDeclaringClassName"),
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#methodName() methodName} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for methodName
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodName(String value) {
if (this.methodName.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
Preconditions.checkNotNull(value, "methodName"),
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#methodAnnotation() methodAnnotation} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for methodAnnotation
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodAnnotation(String value) {
if (this.methodAnnotation.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
Preconditions.checkNotNull(value, "methodAnnotation"),
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object with elements that replace the content of {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodParameterTypes(String... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
newValue,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object with elements that replace the content of {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of methodParameterTypes elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodParameterTypes(Iterable elements) {
if (this.methodParameterTypes == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
newValue,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#methodReturnType() methodReturnType} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for methodReturnType
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodReturnType(String value) {
if (this.methodReturnType.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
Preconditions.checkNotNull(value, "methodReturnType"),
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object with elements that replace the content of {@link InstrumentationConfig#methodModifiers() methodModifiers}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodModifiers(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
newValue,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object with elements that replace the content of {@link InstrumentationConfig#methodModifiers() methodModifiers}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of methodModifiers elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableInstrumentationConfig withMethodModifiers(Iterable extends AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier> elements) {
if (this.methodModifiers == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
newValue,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#nestingGroup() nestingGroup} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for nestingGroup
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withNestingGroup(String value) {
if (this.nestingGroup.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
Preconditions.checkNotNull(value, "nestingGroup"),
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#priority() priority} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for priority
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withPriority(int value) {
if (this.priority == value) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
value,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#captureKind() captureKind} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for captureKind
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withCaptureKind(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind value) {
if (this.captureKind == value) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
Preconditions.checkNotNull(value, "captureKind"),
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#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 ImmutableInstrumentationConfig withTransactionType(String value) {
if (this.transactionType.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
Preconditions.checkNotNull(value, "transactionType"),
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#transactionNameTemplate() transactionNameTemplate} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for transactionNameTemplate
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTransactionNameTemplate(String value) {
if (this.transactionNameTemplate.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
Preconditions.checkNotNull(value, "transactionNameTemplate"),
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#transactionUserTemplate() transactionUserTemplate} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for transactionUserTemplate
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTransactionUserTemplate(String value) {
if (this.transactionUserTemplate.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
Preconditions.checkNotNull(value, "transactionUserTemplate"),
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by replacing the {@link InstrumentationConfig#transactionAttributeTemplates() transactionAttributeTemplates} map with the specified map.
* Nulls are not permitted as keys or values.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param entries The entries to be added to the transactionAttributeTemplates map
* @return A modified copy of {@code this} object
*/
public final ImmutableInstrumentationConfig withTransactionAttributeTemplates(Map entries) {
if (this.transactionAttributeTemplates == entries) return this;
ImmutableMap value = ImmutableMap.copyOf(entries);
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
value,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#transactionSlowThresholdMillis() transactionSlowThresholdMillis} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for transactionSlowThresholdMillis (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTransactionSlowThresholdMillis(@Nullable Integer value) {
if (Objects.equal(this.transactionSlowThresholdMillis, value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
value,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#traceEntryMessageTemplate() traceEntryMessageTemplate} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for traceEntryMessageTemplate
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTraceEntryMessageTemplate(String value) {
if (this.traceEntryMessageTemplate.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
Preconditions.checkNotNull(value, "traceEntryMessageTemplate"),
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#traceEntryStackThresholdMillis() traceEntryStackThresholdMillis} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for traceEntryStackThresholdMillis (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTraceEntryStackThresholdMillis(@Nullable Integer value) {
if (Objects.equal(this.traceEntryStackThresholdMillis, value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
value,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#traceEntryCaptureSelfNested() traceEntryCaptureSelfNested} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for traceEntryCaptureSelfNested
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTraceEntryCaptureSelfNested(boolean value) {
if (this.traceEntryCaptureSelfNested == value) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
value,
this.timerName,
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#timerName() timerName} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for timerName
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTimerName(String value) {
if (this.timerName.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
Preconditions.checkNotNull(value, "timerName"),
this.enabledProperty,
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#enabledProperty() enabledProperty} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for enabledProperty
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withEnabledProperty(String value) {
if (this.enabledProperty.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
Preconditions.checkNotNull(value, "enabledProperty"),
this.traceEntryEnabledProperty);
}
/**
* Copy the current immutable object by setting a value for the {@link InstrumentationConfig#traceEntryEnabledProperty() traceEntryEnabledProperty} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for traceEntryEnabledProperty
* @return A modified copy of the {@code this} object
*/
public final ImmutableInstrumentationConfig withTraceEntryEnabledProperty(String value) {
if (this.traceEntryEnabledProperty.equals(value)) return this;
return new ImmutableInstrumentationConfig(
this.className,
this.classAnnotation,
this.methodDeclaringClassName,
this.methodName,
this.methodAnnotation,
this.methodParameterTypes,
this.methodReturnType,
this.methodModifiers,
this.nestingGroup,
this.priority,
this.captureKind,
this.transactionType,
this.transactionNameTemplate,
this.transactionUserTemplate,
this.transactionAttributeTemplates,
this.transactionSlowThresholdMillis,
this.traceEntryMessageTemplate,
this.traceEntryStackThresholdMillis,
this.traceEntryCaptureSelfNested,
this.timerName,
this.enabledProperty,
Preconditions.checkNotNull(value, "traceEntryEnabledProperty"));
}
/**
* This instance is equal to all instances of {@code ImmutableInstrumentationConfig} 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 ImmutableInstrumentationConfig
&& equalTo((ImmutableInstrumentationConfig) another);
}
private boolean equalTo(ImmutableInstrumentationConfig another) {
return className.equals(another.className)
&& classAnnotation.equals(another.classAnnotation)
&& methodDeclaringClassName.equals(another.methodDeclaringClassName)
&& methodName.equals(another.methodName)
&& methodAnnotation.equals(another.methodAnnotation)
&& methodParameterTypes.equals(another.methodParameterTypes)
&& methodReturnType.equals(another.methodReturnType)
&& methodModifiers.equals(another.methodModifiers)
&& nestingGroup.equals(another.nestingGroup)
&& priority == another.priority
&& captureKind.equals(another.captureKind)
&& transactionType.equals(another.transactionType)
&& transactionNameTemplate.equals(another.transactionNameTemplate)
&& transactionUserTemplate.equals(another.transactionUserTemplate)
&& transactionAttributeTemplates.equals(another.transactionAttributeTemplates)
&& Objects.equal(transactionSlowThresholdMillis, another.transactionSlowThresholdMillis)
&& traceEntryMessageTemplate.equals(another.traceEntryMessageTemplate)
&& Objects.equal(traceEntryStackThresholdMillis, another.traceEntryStackThresholdMillis)
&& traceEntryCaptureSelfNested == another.traceEntryCaptureSelfNested
&& timerName.equals(another.timerName)
&& enabledProperty.equals(another.enabledProperty)
&& traceEntryEnabledProperty.equals(another.traceEntryEnabledProperty)
&& isTimerOrGreater == another.isTimerOrGreater
&& isTraceEntryOrGreater == another.isTraceEntryOrGreater
&& isTransaction == another.isTransaction
&& validationErrors.equals(another.validationErrors);
}
/**
* Computes a hash code from attributes: {@code className}, {@code classAnnotation}, {@code methodDeclaringClassName}, {@code methodName}, {@code methodAnnotation}, {@code methodParameterTypes}, {@code methodReturnType}, {@code methodModifiers}, {@code nestingGroup}, {@code priority}, {@code captureKind}, {@code transactionType}, {@code transactionNameTemplate}, {@code transactionUserTemplate}, {@code transactionAttributeTemplates}, {@code transactionSlowThresholdMillis}, {@code traceEntryMessageTemplate}, {@code traceEntryStackThresholdMillis}, {@code traceEntryCaptureSelfNested}, {@code timerName}, {@code enabledProperty}, {@code traceEntryEnabledProperty}, {@code isTimerOrGreater}, {@code isTraceEntryOrGreater}, {@code isTransaction}, {@code validationErrors}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 31;
h = h * 17 + className.hashCode();
h = h * 17 + classAnnotation.hashCode();
h = h * 17 + methodDeclaringClassName.hashCode();
h = h * 17 + methodName.hashCode();
h = h * 17 + methodAnnotation.hashCode();
h = h * 17 + methodParameterTypes.hashCode();
h = h * 17 + methodReturnType.hashCode();
h = h * 17 + methodModifiers.hashCode();
h = h * 17 + nestingGroup.hashCode();
h = h * 17 + priority;
h = h * 17 + captureKind.hashCode();
h = h * 17 + transactionType.hashCode();
h = h * 17 + transactionNameTemplate.hashCode();
h = h * 17 + transactionUserTemplate.hashCode();
h = h * 17 + transactionAttributeTemplates.hashCode();
h = h * 17 + Objects.hashCode(transactionSlowThresholdMillis);
h = h * 17 + traceEntryMessageTemplate.hashCode();
h = h * 17 + Objects.hashCode(traceEntryStackThresholdMillis);
h = h * 17 + Booleans.hashCode(traceEntryCaptureSelfNested);
h = h * 17 + timerName.hashCode();
h = h * 17 + enabledProperty.hashCode();
h = h * 17 + traceEntryEnabledProperty.hashCode();
h = h * 17 + Booleans.hashCode(isTimerOrGreater);
h = h * 17 + Booleans.hashCode(isTraceEntryOrGreater);
h = h * 17 + Booleans.hashCode(isTransaction);
h = h * 17 + validationErrors.hashCode();
return h;
}
/**
* Prints the immutable value {@code InstrumentationConfig...} with all non-generated
* and non-auxiliary attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("InstrumentationConfig")
.add("className", className)
.add("classAnnotation", classAnnotation)
.add("methodDeclaringClassName", methodDeclaringClassName)
.add("methodName", methodName)
.add("methodAnnotation", methodAnnotation)
.add("methodParameterTypes", methodParameterTypes)
.add("methodReturnType", methodReturnType)
.add("methodModifiers", methodModifiers)
.add("nestingGroup", nestingGroup)
.add("priority", priority)
.add("captureKind", captureKind)
.add("transactionType", transactionType)
.add("transactionNameTemplate", transactionNameTemplate)
.add("transactionUserTemplate", transactionUserTemplate)
.add("transactionAttributeTemplates", transactionAttributeTemplates)
.add("transactionSlowThresholdMillis", transactionSlowThresholdMillis)
.add("traceEntryMessageTemplate", traceEntryMessageTemplate)
.add("traceEntryStackThresholdMillis", traceEntryStackThresholdMillis)
.add("traceEntryCaptureSelfNested", traceEntryCaptureSelfNested)
.add("timerName", timerName)
.add("enabledProperty", enabledProperty)
.add("traceEntryEnabledProperty", traceEntryEnabledProperty)
.add("isTimerOrGreater", isTimerOrGreater)
.add("isTraceEntryOrGreater", isTraceEntryOrGreater)
.add("isTransaction", isTransaction)
.add("validationErrors", validationErrors)
.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 InstrumentationConfig {
@Nullable String className;
@Nullable String classAnnotation;
@Nullable String methodDeclaringClassName;
@Nullable String methodName;
@Nullable String methodAnnotation;
ImmutableList methodParameterTypes = ImmutableList.of();
@Nullable String methodReturnType;
ImmutableList methodModifiers = ImmutableList.of();
@Nullable String nestingGroup;
@Nullable Integer priority;
@Nullable AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind;
@Nullable String transactionType;
@Nullable String transactionNameTemplate;
@Nullable String transactionUserTemplate;
@Nullable Map transactionAttributeTemplates;
@Nullable Integer transactionSlowThresholdMillis;
@Nullable String traceEntryMessageTemplate;
@Nullable Integer traceEntryStackThresholdMillis;
@Nullable Boolean traceEntryCaptureSelfNested;
@Nullable String timerName;
@Nullable String enabledProperty;
@Nullable String traceEntryEnabledProperty;
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setClassName(String className) {
this.className = className;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setClassAnnotation(String classAnnotation) {
this.classAnnotation = classAnnotation;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setMethodDeclaringClassName(String methodDeclaringClassName) {
this.methodDeclaringClassName = methodDeclaringClassName;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setMethodName(String methodName) {
this.methodName = methodName;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setMethodAnnotation(String methodAnnotation) {
this.methodAnnotation = methodAnnotation;
}
@JsonProperty
public void setMethodParameterTypes(ImmutableList methodParameterTypes) {
this.methodParameterTypes = methodParameterTypes;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setMethodReturnType(String methodReturnType) {
this.methodReturnType = methodReturnType;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setMethodModifiers(ImmutableList methodModifiers) {
this.methodModifiers = methodModifiers;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setNestingGroup(String nestingGroup) {
this.nestingGroup = nestingGroup;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setPriority(int priority) {
this.priority = priority;
}
@JsonProperty
public void setCaptureKind(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind) {
this.captureKind = captureKind;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTransactionType(String transactionType) {
this.transactionType = transactionType;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTransactionNameTemplate(String transactionNameTemplate) {
this.transactionNameTemplate = transactionNameTemplate;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTransactionUserTemplate(String transactionUserTemplate) {
this.transactionUserTemplate = transactionUserTemplate;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTransactionAttributeTemplates(Map transactionAttributeTemplates) {
this.transactionAttributeTemplates = transactionAttributeTemplates;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public void setTransactionSlowThresholdMillis(@Nullable Integer transactionSlowThresholdMillis) {
this.transactionSlowThresholdMillis = transactionSlowThresholdMillis;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTraceEntryMessageTemplate(String traceEntryMessageTemplate) {
this.traceEntryMessageTemplate = traceEntryMessageTemplate;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public void setTraceEntryStackThresholdMillis(@Nullable Integer traceEntryStackThresholdMillis) {
this.traceEntryStackThresholdMillis = traceEntryStackThresholdMillis;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTraceEntryCaptureSelfNested(boolean traceEntryCaptureSelfNested) {
this.traceEntryCaptureSelfNested = traceEntryCaptureSelfNested;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTimerName(String timerName) {
this.timerName = timerName;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setEnabledProperty(String enabledProperty) {
this.enabledProperty = enabledProperty;
}
@JsonProperty
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public void setTraceEntryEnabledProperty(String traceEntryEnabledProperty) {
this.traceEntryEnabledProperty = traceEntryEnabledProperty;
}
@Override
public String className() { throw new UnsupportedOperationException(); }
@Override
public String classAnnotation() { throw new UnsupportedOperationException(); }
@Override
public String methodDeclaringClassName() { throw new UnsupportedOperationException(); }
@Override
public String methodName() { throw new UnsupportedOperationException(); }
@Override
public String methodAnnotation() { throw new UnsupportedOperationException(); }
@Override
public ImmutableList methodParameterTypes() { throw new UnsupportedOperationException(); }
@Override
public String methodReturnType() { throw new UnsupportedOperationException(); }
@Override
public ImmutableList methodModifiers() { throw new UnsupportedOperationException(); }
@Override
public String nestingGroup() { throw new UnsupportedOperationException(); }
@Override
public int priority() { throw new UnsupportedOperationException(); }
@Override
public AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind() { throw new UnsupportedOperationException(); }
@Override
public String transactionType() { throw new UnsupportedOperationException(); }
@Override
public String transactionNameTemplate() { throw new UnsupportedOperationException(); }
@Override
public String transactionUserTemplate() { throw new UnsupportedOperationException(); }
@Override
public Map transactionAttributeTemplates() { throw new UnsupportedOperationException(); }
@Override
public Integer transactionSlowThresholdMillis() { throw new UnsupportedOperationException(); }
@Override
public String traceEntryMessageTemplate() { throw new UnsupportedOperationException(); }
@Override
public Integer traceEntryStackThresholdMillis() { throw new UnsupportedOperationException(); }
@Override
public boolean traceEntryCaptureSelfNested() { throw new UnsupportedOperationException(); }
@Override
public String timerName() { throw new UnsupportedOperationException(); }
@Override
public String enabledProperty() { throw new UnsupportedOperationException(); }
@Override
public String traceEntryEnabledProperty() { throw new UnsupportedOperationException(); }
@Override
public boolean isTimerOrGreater() { throw new UnsupportedOperationException(); }
@Override
public boolean isTraceEntryOrGreater() { throw new UnsupportedOperationException(); }
@Override
public boolean isTransaction() { throw new UnsupportedOperationException(); }
@Override
public ImmutableList validationErrors() { 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 ImmutableInstrumentationConfig fromJson(Json json) {
ImmutableInstrumentationConfig.Builder builder = ImmutableInstrumentationConfig.builder();
if (json.className != null) {
builder.className(json.className);
}
if (json.classAnnotation != null) {
builder.classAnnotation(json.classAnnotation);
}
if (json.methodDeclaringClassName != null) {
builder.methodDeclaringClassName(json.methodDeclaringClassName);
}
if (json.methodName != null) {
builder.methodName(json.methodName);
}
if (json.methodAnnotation != null) {
builder.methodAnnotation(json.methodAnnotation);
}
if (json.methodParameterTypes != null) {
builder.addAllMethodParameterTypes(json.methodParameterTypes);
}
if (json.methodReturnType != null) {
builder.methodReturnType(json.methodReturnType);
}
if (json.methodModifiers != null) {
builder.addAllMethodModifiers(json.methodModifiers);
}
if (json.nestingGroup != null) {
builder.nestingGroup(json.nestingGroup);
}
if (json.priority != null) {
builder.priority(json.priority);
}
if (json.captureKind != null) {
builder.captureKind(json.captureKind);
}
if (json.transactionType != null) {
builder.transactionType(json.transactionType);
}
if (json.transactionNameTemplate != null) {
builder.transactionNameTemplate(json.transactionNameTemplate);
}
if (json.transactionUserTemplate != null) {
builder.transactionUserTemplate(json.transactionUserTemplate);
}
if (json.transactionAttributeTemplates != null) {
builder.putAllTransactionAttributeTemplates(json.transactionAttributeTemplates);
}
if (json.transactionSlowThresholdMillis != null) {
builder.transactionSlowThresholdMillis(json.transactionSlowThresholdMillis);
}
if (json.traceEntryMessageTemplate != null) {
builder.traceEntryMessageTemplate(json.traceEntryMessageTemplate);
}
if (json.traceEntryStackThresholdMillis != null) {
builder.traceEntryStackThresholdMillis(json.traceEntryStackThresholdMillis);
}
if (json.traceEntryCaptureSelfNested != null) {
builder.traceEntryCaptureSelfNested(json.traceEntryCaptureSelfNested);
}
if (json.timerName != null) {
builder.timerName(json.timerName);
}
if (json.enabledProperty != null) {
builder.enabledProperty(json.enabledProperty);
}
if (json.traceEntryEnabledProperty != null) {
builder.traceEntryEnabledProperty(json.traceEntryEnabledProperty);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link InstrumentationConfig} 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 InstrumentationConfig instance
*/
public static ImmutableInstrumentationConfig copyOf(InstrumentationConfig instance) {
if (instance instanceof ImmutableInstrumentationConfig) {
return (ImmutableInstrumentationConfig) instance;
}
return ImmutableInstrumentationConfig.builder()
.copyFrom(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableInstrumentationConfig ImmutableInstrumentationConfig}.
* @return A new ImmutableInstrumentationConfig builder
*/
public static ImmutableInstrumentationConfig.Builder builder() {
return new ImmutableInstrumentationConfig.Builder();
}
/**
* Builds instances of type {@link ImmutableInstrumentationConfig ImmutableInstrumentationConfig}.
* 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
public static final class Builder {
private static final long INIT_BIT_CAPTURE_KIND = 0x1L;
private static final long OPT_BIT_PRIORITY = 0x1L;
private static final long OPT_BIT_TRACE_ENTRY_CAPTURE_SELF_NESTED = 0x2L;
private long initBits = 0x1;
private long optBits;
private @Nullable String className;
private @Nullable String classAnnotation;
private @Nullable String methodDeclaringClassName;
private @Nullable String methodName;
private @Nullable String methodAnnotation;
private ImmutableList.Builder methodParameterTypesBuilder = ImmutableList.builder();
private @Nullable String methodReturnType;
private ImmutableList.Builder methodModifiersBuilder = ImmutableList.builder();
private @Nullable String nestingGroup;
private int priority;
private @Nullable AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind;
private @Nullable String transactionType;
private @Nullable String transactionNameTemplate;
private @Nullable String transactionUserTemplate;
private ImmutableMap.Builder transactionAttributeTemplatesBuilder = ImmutableMap.builder();
private @Nullable Integer transactionSlowThresholdMillis;
private @Nullable String traceEntryMessageTemplate;
private @Nullable Integer traceEntryStackThresholdMillis;
private boolean traceEntryCaptureSelfNested;
private @Nullable String timerName;
private @Nullable String enabledProperty;
private @Nullable String traceEntryEnabledProperty;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code InstrumentationConfig} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* Collection elements and entries will be added, not replaced.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder copyFrom(InstrumentationConfig instance) {
Preconditions.checkNotNull(instance, "instance");
className(instance.className());
classAnnotation(instance.classAnnotation());
methodDeclaringClassName(instance.methodDeclaringClassName());
methodName(instance.methodName());
methodAnnotation(instance.methodAnnotation());
addAllMethodParameterTypes(instance.methodParameterTypes());
methodReturnType(instance.methodReturnType());
addAllMethodModifiers(instance.methodModifiers());
nestingGroup(instance.nestingGroup());
priority(instance.priority());
captureKind(instance.captureKind());
transactionType(instance.transactionType());
transactionNameTemplate(instance.transactionNameTemplate());
transactionUserTemplate(instance.transactionUserTemplate());
putAllTransactionAttributeTemplates(instance.transactionAttributeTemplates());
@Nullable Integer transactionSlowThresholdMillisValue = instance.transactionSlowThresholdMillis();
if (transactionSlowThresholdMillisValue != null) {
transactionSlowThresholdMillis(transactionSlowThresholdMillisValue);
}
traceEntryMessageTemplate(instance.traceEntryMessageTemplate());
@Nullable Integer traceEntryStackThresholdMillisValue = instance.traceEntryStackThresholdMillis();
if (traceEntryStackThresholdMillisValue != null) {
traceEntryStackThresholdMillis(traceEntryStackThresholdMillisValue);
}
traceEntryCaptureSelfNested(instance.traceEntryCaptureSelfNested());
timerName(instance.timerName());
enabledProperty(instance.enabledProperty());
traceEntryEnabledProperty(instance.traceEntryEnabledProperty());
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#className() className} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#className() className}.
* @param className The value for className
* @return {@code this} builder for use in a chained invocation
*/
public final Builder className(String className) {
this.className = Preconditions.checkNotNull(className, "className");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#classAnnotation() classAnnotation} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#classAnnotation() classAnnotation}.
* @param classAnnotation The value for classAnnotation
* @return {@code this} builder for use in a chained invocation
*/
public final Builder classAnnotation(String classAnnotation) {
this.classAnnotation = Preconditions.checkNotNull(classAnnotation, "classAnnotation");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#methodDeclaringClassName() methodDeclaringClassName} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#methodDeclaringClassName() methodDeclaringClassName}.
* @param methodDeclaringClassName The value for methodDeclaringClassName
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodDeclaringClassName(String methodDeclaringClassName) {
this.methodDeclaringClassName = Preconditions.checkNotNull(methodDeclaringClassName, "methodDeclaringClassName");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#methodName() methodName} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#methodName() methodName}.
* @param methodName The value for methodName
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodName(String methodName) {
this.methodName = Preconditions.checkNotNull(methodName, "methodName");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#methodAnnotation() methodAnnotation} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#methodAnnotation() methodAnnotation}.
* @param methodAnnotation The value for methodAnnotation
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodAnnotation(String methodAnnotation) {
this.methodAnnotation = Preconditions.checkNotNull(methodAnnotation, "methodAnnotation");
return this;
}
/**
* Adds one element to {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes} list.
* @param element A methodParameterTypes element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addMethodParameterTypes(String element) {
methodParameterTypesBuilder.add(element);
return this;
}
/**
* Adds elements to {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes} list.
* @param elements An array of methodParameterTypes elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addMethodParameterTypes(String... elements) {
methodParameterTypesBuilder.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes} list.
* @param elements An iterable of methodParameterTypes elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodParameterTypes(Iterable elements) {
methodParameterTypesBuilder = ImmutableList.builder();
return addAllMethodParameterTypes(elements);
}
/**
* Adds elements to {@link InstrumentationConfig#methodParameterTypes() methodParameterTypes} list.
* @param elements An iterable of methodParameterTypes elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllMethodParameterTypes(Iterable elements) {
methodParameterTypesBuilder.addAll(elements);
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#methodReturnType() methodReturnType} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#methodReturnType() methodReturnType}.
* @param methodReturnType The value for methodReturnType
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodReturnType(String methodReturnType) {
this.methodReturnType = Preconditions.checkNotNull(methodReturnType, "methodReturnType");
return this;
}
/**
* Adds one element to {@link InstrumentationConfig#methodModifiers() methodModifiers} list.
* @param element A methodModifiers element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addMethodModifiers(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier element) {
methodModifiersBuilder.add(element);
return this;
}
/**
* Adds elements to {@link InstrumentationConfig#methodModifiers() methodModifiers} list.
* @param elements An array of methodModifiers elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addMethodModifiers(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier... elements) {
methodModifiersBuilder.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link InstrumentationConfig#methodModifiers() methodModifiers} list.
* @param elements An iterable of methodModifiers elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder methodModifiers(Iterable extends AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier> elements) {
methodModifiersBuilder = ImmutableList.builder();
return addAllMethodModifiers(elements);
}
/**
* Adds elements to {@link InstrumentationConfig#methodModifiers() methodModifiers} list.
* @param elements An iterable of methodModifiers elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllMethodModifiers(Iterable extends AgentConfigOuterClass.AgentConfig.InstrumentationConfig.MethodModifier> elements) {
methodModifiersBuilder.addAll(elements);
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#nestingGroup() nestingGroup} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#nestingGroup() nestingGroup}.
* @param nestingGroup The value for nestingGroup
* @return {@code this} builder for use in a chained invocation
*/
public final Builder nestingGroup(String nestingGroup) {
this.nestingGroup = Preconditions.checkNotNull(nestingGroup, "nestingGroup");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#priority() priority} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#priority() priority}.
* @param priority The value for priority
* @return {@code this} builder for use in a chained invocation
*/
public final Builder priority(int priority) {
this.priority = priority;
optBits |= OPT_BIT_PRIORITY;
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#captureKind() captureKind} attribute.
* @param captureKind The value for captureKind
* @return {@code this} builder for use in a chained invocation
*/
public final Builder captureKind(AgentConfigOuterClass.AgentConfig.InstrumentationConfig.CaptureKind captureKind) {
this.captureKind = Preconditions.checkNotNull(captureKind, "captureKind");
initBits &= ~INIT_BIT_CAPTURE_KIND;
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#transactionType() transactionType} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#transactionType() transactionType}.
* @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");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#transactionNameTemplate() transactionNameTemplate} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#transactionNameTemplate() transactionNameTemplate}.
* @param transactionNameTemplate The value for transactionNameTemplate
* @return {@code this} builder for use in a chained invocation
*/
public final Builder transactionNameTemplate(String transactionNameTemplate) {
this.transactionNameTemplate = Preconditions.checkNotNull(transactionNameTemplate, "transactionNameTemplate");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#transactionUserTemplate() transactionUserTemplate} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#transactionUserTemplate() transactionUserTemplate}.
* @param transactionUserTemplate The value for transactionUserTemplate
* @return {@code this} builder for use in a chained invocation
*/
public final Builder transactionUserTemplate(String transactionUserTemplate) {
this.transactionUserTemplate = Preconditions.checkNotNull(transactionUserTemplate, "transactionUserTemplate");
return this;
}
/**
* Put one entry to the {@link InstrumentationConfig#transactionAttributeTemplates() transactionAttributeTemplates} map.
* @param key The key in the transactionAttributeTemplates map
* @param value The associated value in the transactionAttributeTemplates map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putTransactionAttributeTemplates(String key, String value) {
transactionAttributeTemplatesBuilder.put(key, value);
return this;
}
/**
* Put one entry to the {@link InstrumentationConfig#transactionAttributeTemplates() transactionAttributeTemplates} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putTransactionAttributeTemplates(Map.Entry entry) {
transactionAttributeTemplatesBuilder.put(entry);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link InstrumentationConfig#transactionAttributeTemplates() transactionAttributeTemplates} map. Nulls are not permitted
* @param entries The entries that will be added to the transactionAttributeTemplates map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder transactionAttributeTemplates(Map entries) {
transactionAttributeTemplatesBuilder = ImmutableMap.builder();
return putAllTransactionAttributeTemplates(entries);
}
/**
* Put all mappings from the specified map as entries to {@link InstrumentationConfig#transactionAttributeTemplates() transactionAttributeTemplates} map. Nulls are not permitted
* @param entries The entries that will be added to the transactionAttributeTemplates map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putAllTransactionAttributeTemplates(Map entries) {
transactionAttributeTemplatesBuilder.putAll(entries);
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#transactionSlowThresholdMillis() transactionSlowThresholdMillis} attribute.
* @param transactionSlowThresholdMillis The value for transactionSlowThresholdMillis (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder transactionSlowThresholdMillis(@Nullable Integer transactionSlowThresholdMillis) {
this.transactionSlowThresholdMillis = transactionSlowThresholdMillis;
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#traceEntryMessageTemplate() traceEntryMessageTemplate} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#traceEntryMessageTemplate() traceEntryMessageTemplate}.
* @param traceEntryMessageTemplate The value for traceEntryMessageTemplate
* @return {@code this} builder for use in a chained invocation
*/
public final Builder traceEntryMessageTemplate(String traceEntryMessageTemplate) {
this.traceEntryMessageTemplate = Preconditions.checkNotNull(traceEntryMessageTemplate, "traceEntryMessageTemplate");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#traceEntryStackThresholdMillis() traceEntryStackThresholdMillis} attribute.
* @param traceEntryStackThresholdMillis The value for traceEntryStackThresholdMillis (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder traceEntryStackThresholdMillis(@Nullable Integer traceEntryStackThresholdMillis) {
this.traceEntryStackThresholdMillis = traceEntryStackThresholdMillis;
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#traceEntryCaptureSelfNested() traceEntryCaptureSelfNested} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#traceEntryCaptureSelfNested() traceEntryCaptureSelfNested}.
* @param traceEntryCaptureSelfNested The value for traceEntryCaptureSelfNested
* @return {@code this} builder for use in a chained invocation
*/
public final Builder traceEntryCaptureSelfNested(boolean traceEntryCaptureSelfNested) {
this.traceEntryCaptureSelfNested = traceEntryCaptureSelfNested;
optBits |= OPT_BIT_TRACE_ENTRY_CAPTURE_SELF_NESTED;
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#timerName() timerName} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#timerName() timerName}.
* @param timerName The value for timerName
* @return {@code this} builder for use in a chained invocation
*/
public final Builder timerName(String timerName) {
this.timerName = Preconditions.checkNotNull(timerName, "timerName");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#enabledProperty() enabledProperty} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#enabledProperty() enabledProperty}.
* @param enabledProperty The value for enabledProperty
* @return {@code this} builder for use in a chained invocation
*/
public final Builder enabledProperty(String enabledProperty) {
this.enabledProperty = Preconditions.checkNotNull(enabledProperty, "enabledProperty");
return this;
}
/**
* Initializes the value for the {@link InstrumentationConfig#traceEntryEnabledProperty() traceEntryEnabledProperty} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link InstrumentationConfig#traceEntryEnabledProperty() traceEntryEnabledProperty}.
* @param traceEntryEnabledProperty The value for traceEntryEnabledProperty
* @return {@code this} builder for use in a chained invocation
*/
public final Builder traceEntryEnabledProperty(String traceEntryEnabledProperty) {
this.traceEntryEnabledProperty = Preconditions.checkNotNull(traceEntryEnabledProperty, "traceEntryEnabledProperty");
return this;
}
/**
* Builds a new {@link ImmutableInstrumentationConfig ImmutableInstrumentationConfig}.
* @return An immutable instance of InstrumentationConfig
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableInstrumentationConfig build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableInstrumentationConfig(this);
}
private boolean priorityIsSet() {
return (optBits & OPT_BIT_PRIORITY) != 0;
}
private boolean traceEntryCaptureSelfNestedIsSet() {
return (optBits & OPT_BIT_TRACE_ENTRY_CAPTURE_SELF_NESTED) != 0;
}
private String formatRequiredAttributesMessage() {
List attributes = Lists.newArrayList();
if ((initBits & INIT_BIT_CAPTURE_KIND) != 0) attributes.add("captureKind");
return "Cannot build InstrumentationConfig, some of required attributes are not set " + attributes;
}
}
}