org.glowroot.agent.config.ImmutableAllConfig Maven / Gradle / Ivy
Show all versions of glowroot-agent-it-harness Show documentation
package org.glowroot.agent.config;
import org.glowroot.agent.shaded.com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.glowroot.agent.shaded.com.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.agent.shaded.com.fasterxml.jackson.annotation.JsonProperty;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.com.google.common.base.MoreObjects;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.com.google.common.base.Preconditions;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.com.google.common.collect.ImmutableList;
import org.glowroot.agent.shaded.org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.com.google.errorprone.annotations.CanIgnoreReturnValue;
import org.glowroot.agent.shaded.org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.com.google.errorprone.annotations.Var;
import java.util.ArrayList;
import java.util.List;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.CheckReturnValue;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.Generated;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.Nullable;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.ParametersAreNonnullByDefault;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.concurrent.Immutable;
import org.glowroot.agent.shaded.org.glowroot.agent.it.harness.shaded.javax.annotation.concurrent.NotThreadSafe;
import org.glowroot.agent.shaded.org.glowroot.common.config.AdvancedConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.AlertConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.GaugeConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.InstrumentationConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.JvmConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.SyntheticMonitorConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.TransactionConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.UiDefaultsConfig;
import org.glowroot.agent.shaded.org.glowroot.common.config.UserRecordingConfig;
/**
* Immutable implementation of {@link AllConfig}.
*
* Use the builder to create immutable instances:
* {@code ImmutableAllConfig.builder()}.
*/
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableAllConfig extends AllConfig {
private final TransactionConfig transaction;
private final JvmConfig jvm;
private final UiDefaultsConfig uiDefaults;
private final UserRecordingConfig userRecording;
private final AdvancedConfig advanced;
private final ImmutableList gauges;
private final ImmutableList syntheticMonitors;
private final ImmutableList alerts;
private final ImmutableList plugins;
private final ImmutableList instrumentation;
private ImmutableAllConfig(
TransactionConfig transaction,
JvmConfig jvm,
UiDefaultsConfig uiDefaults,
UserRecordingConfig userRecording,
AdvancedConfig advanced,
ImmutableList gauges,
ImmutableList syntheticMonitors,
ImmutableList alerts,
ImmutableList plugins,
ImmutableList instrumentation) {
this.transaction = transaction;
this.jvm = jvm;
this.uiDefaults = uiDefaults;
this.userRecording = userRecording;
this.advanced = advanced;
this.gauges = gauges;
this.syntheticMonitors = syntheticMonitors;
this.alerts = alerts;
this.plugins = plugins;
this.instrumentation = instrumentation;
}
/**
* @return The value of the {@code transaction} attribute
*/
@JsonProperty("transaction")
@Override
TransactionConfig transaction() {
return transaction;
}
/**
* @return The value of the {@code jvm} attribute
*/
@JsonProperty("jvm")
@Override
JvmConfig jvm() {
return jvm;
}
/**
* @return The value of the {@code uiDefaults} attribute
*/
@JsonProperty("uiDefaults")
@Override
UiDefaultsConfig uiDefaults() {
return uiDefaults;
}
/**
* @return The value of the {@code userRecording} attribute
*/
@JsonProperty("userRecording")
@Override
UserRecordingConfig userRecording() {
return userRecording;
}
/**
* @return The value of the {@code advanced} attribute
*/
@JsonProperty("advanced")
@Override
AdvancedConfig advanced() {
return advanced;
}
/**
* @return The value of the {@code gauges} attribute
*/
@JsonProperty("gauges")
@Override
ImmutableList gauges() {
return gauges;
}
/**
* @return The value of the {@code syntheticMonitors} attribute
*/
@JsonProperty("syntheticMonitors")
@Override
ImmutableList syntheticMonitors() {
return syntheticMonitors;
}
/**
* @return The value of the {@code alerts} attribute
*/
@JsonProperty("alerts")
@Override
ImmutableList alerts() {
return alerts;
}
/**
* @return The value of the {@code plugins} attribute
*/
@JsonProperty("plugins")
@Override
ImmutableList plugins() {
return plugins;
}
/**
* @return The value of the {@code instrumentation} attribute
*/
@JsonProperty("instrumentation")
@Override
ImmutableList instrumentation() {
return instrumentation;
}
/**
* Copy the current immutable object by setting a value for the {@link AllConfig#transaction() transaction} 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 transaction
* @return A modified copy of the {@code this} object
*/
public final ImmutableAllConfig withTransaction(TransactionConfig value) {
if (this.transaction == value) return this;
TransactionConfig newValue = Preconditions.checkNotNull(value, "transaction");
return new ImmutableAllConfig(
newValue,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object by setting a value for the {@link AllConfig#jvm() jvm} 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 jvm
* @return A modified copy of the {@code this} object
*/
public final ImmutableAllConfig withJvm(JvmConfig value) {
if (this.jvm == value) return this;
JvmConfig newValue = Preconditions.checkNotNull(value, "jvm");
return new ImmutableAllConfig(
this.transaction,
newValue,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object by setting a value for the {@link AllConfig#uiDefaults() uiDefaults} 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 uiDefaults
* @return A modified copy of the {@code this} object
*/
public final ImmutableAllConfig withUiDefaults(UiDefaultsConfig value) {
if (this.uiDefaults == value) return this;
UiDefaultsConfig newValue = Preconditions.checkNotNull(value, "uiDefaults");
return new ImmutableAllConfig(
this.transaction,
this.jvm,
newValue,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object by setting a value for the {@link AllConfig#userRecording() userRecording} 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 userRecording
* @return A modified copy of the {@code this} object
*/
public final ImmutableAllConfig withUserRecording(UserRecordingConfig value) {
if (this.userRecording == value) return this;
UserRecordingConfig newValue = Preconditions.checkNotNull(value, "userRecording");
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
newValue,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object by setting a value for the {@link AllConfig#advanced() advanced} 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 advanced
* @return A modified copy of the {@code this} object
*/
public final ImmutableAllConfig withAdvanced(AdvancedConfig value) {
if (this.advanced == value) return this;
AdvancedConfig newValue = Preconditions.checkNotNull(value, "advanced");
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
newValue,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#gauges() gauges}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withGauges(GaugeConfig... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
newValue,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#gauges() gauges}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of gauges elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withGauges(Iterable extends GaugeConfig> elements) {
if (this.gauges == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
newValue,
this.syntheticMonitors,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#syntheticMonitors() syntheticMonitors}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withSyntheticMonitors(SyntheticMonitorConfig... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
newValue,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#syntheticMonitors() syntheticMonitors}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of syntheticMonitors elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withSyntheticMonitors(Iterable extends SyntheticMonitorConfig> elements) {
if (this.syntheticMonitors == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
newValue,
this.alerts,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#alerts() alerts}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withAlerts(AlertConfig... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
newValue,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#alerts() alerts}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of alerts elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withAlerts(Iterable extends AlertConfig> elements) {
if (this.alerts == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
newValue,
this.plugins,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#plugins() plugins}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withPlugins(PluginConfig... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
newValue,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#plugins() plugins}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of plugins elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withPlugins(Iterable extends PluginConfig> elements) {
if (this.plugins == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
newValue,
this.instrumentation);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#instrumentation() instrumentation}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withInstrumentation(InstrumentationConfig... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
newValue);
}
/**
* Copy the current immutable object with elements that replace the content of {@link AllConfig#instrumentation() instrumentation}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of instrumentation elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableAllConfig withInstrumentation(Iterable extends InstrumentationConfig> elements) {
if (this.instrumentation == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableAllConfig(
this.transaction,
this.jvm,
this.uiDefaults,
this.userRecording,
this.advanced,
this.gauges,
this.syntheticMonitors,
this.alerts,
this.plugins,
newValue);
}
/**
* This instance is equal to all instances of {@code ImmutableAllConfig} 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 ImmutableAllConfig
&& equalTo((ImmutableAllConfig) another);
}
private boolean equalTo(ImmutableAllConfig another) {
return transaction.equals(another.transaction)
&& jvm.equals(another.jvm)
&& uiDefaults.equals(another.uiDefaults)
&& userRecording.equals(another.userRecording)
&& advanced.equals(another.advanced)
&& gauges.equals(another.gauges)
&& syntheticMonitors.equals(another.syntheticMonitors)
&& alerts.equals(another.alerts)
&& plugins.equals(another.plugins)
&& instrumentation.equals(another.instrumentation);
}
/**
* Computes a hash code from attributes: {@code transaction}, {@code jvm}, {@code uiDefaults}, {@code userRecording}, {@code advanced}, {@code gauges}, {@code syntheticMonitors}, {@code alerts}, {@code plugins}, {@code instrumentation}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + transaction.hashCode();
h += (h << 5) + jvm.hashCode();
h += (h << 5) + uiDefaults.hashCode();
h += (h << 5) + userRecording.hashCode();
h += (h << 5) + advanced.hashCode();
h += (h << 5) + gauges.hashCode();
h += (h << 5) + syntheticMonitors.hashCode();
h += (h << 5) + alerts.hashCode();
h += (h << 5) + plugins.hashCode();
h += (h << 5) + instrumentation.hashCode();
return h;
}
/**
* Prints the immutable value {@code AllConfig} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("AllConfig")
.omitNullValues()
.add("transaction", transaction)
.add("jvm", jvm)
.add("uiDefaults", uiDefaults)
.add("userRecording", userRecording)
.add("advanced", advanced)
.add("gauges", gauges)
.add("syntheticMonitors", syntheticMonitors)
.add("alerts", alerts)
.add("plugins", plugins)
.add("instrumentation", instrumentation)
.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
@SuppressWarnings("Immutable")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends AllConfig {
@Nullable TransactionConfig transaction;
@Nullable JvmConfig jvm;
@Nullable UiDefaultsConfig uiDefaults;
@Nullable UserRecordingConfig userRecording;
@Nullable AdvancedConfig advanced;
@Nullable List gauges = ImmutableList.of();
@Nullable List syntheticMonitors = ImmutableList.of();
@Nullable List alerts = ImmutableList.of();
@Nullable List plugins = ImmutableList.of();
@Nullable List instrumentation = ImmutableList.of();
@JsonProperty("transaction")
public void setTransaction(TransactionConfig transaction) {
this.transaction = transaction;
}
@JsonProperty("jvm")
public void setJvm(JvmConfig jvm) {
this.jvm = jvm;
}
@JsonProperty("uiDefaults")
public void setUiDefaults(UiDefaultsConfig uiDefaults) {
this.uiDefaults = uiDefaults;
}
@JsonProperty("userRecording")
public void setUserRecording(UserRecordingConfig userRecording) {
this.userRecording = userRecording;
}
@JsonProperty("advanced")
public void setAdvanced(AdvancedConfig advanced) {
this.advanced = advanced;
}
@JsonProperty("gauges")
public void setGauges(List gauges) {
this.gauges = gauges;
}
@JsonProperty("syntheticMonitors")
public void setSyntheticMonitors(List syntheticMonitors) {
this.syntheticMonitors = syntheticMonitors;
}
@JsonProperty("alerts")
public void setAlerts(List alerts) {
this.alerts = alerts;
}
@JsonProperty("plugins")
public void setPlugins(List plugins) {
this.plugins = plugins;
}
@JsonProperty("instrumentation")
public void setInstrumentation(List instrumentation) {
this.instrumentation = instrumentation;
}
@Override
TransactionConfig transaction() { throw new UnsupportedOperationException(); }
@Override
JvmConfig jvm() { throw new UnsupportedOperationException(); }
@Override
UiDefaultsConfig uiDefaults() { throw new UnsupportedOperationException(); }
@Override
UserRecordingConfig userRecording() { throw new UnsupportedOperationException(); }
@Override
AdvancedConfig advanced() { throw new UnsupportedOperationException(); }
@Override
List gauges() { throw new UnsupportedOperationException(); }
@Override
List syntheticMonitors() { throw new UnsupportedOperationException(); }
@Override
List alerts() { throw new UnsupportedOperationException(); }
@Override
List plugins() { throw new UnsupportedOperationException(); }
@Override
List instrumentation() { 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(mode = JsonCreator.Mode.DELEGATING)
static ImmutableAllConfig fromJson(Json json) {
ImmutableAllConfig.Builder builder = ImmutableAllConfig.builder();
if (json.transaction != null) {
builder.transaction(json.transaction);
}
if (json.jvm != null) {
builder.jvm(json.jvm);
}
if (json.uiDefaults != null) {
builder.uiDefaults(json.uiDefaults);
}
if (json.userRecording != null) {
builder.userRecording(json.userRecording);
}
if (json.advanced != null) {
builder.advanced(json.advanced);
}
if (json.gauges != null) {
builder.addAllGauges(json.gauges);
}
if (json.syntheticMonitors != null) {
builder.addAllSyntheticMonitors(json.syntheticMonitors);
}
if (json.alerts != null) {
builder.addAllAlerts(json.alerts);
}
if (json.plugins != null) {
builder.addAllPlugins(json.plugins);
}
if (json.instrumentation != null) {
builder.addAllInstrumentation(json.instrumentation);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link AllConfig} 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 AllConfig instance
*/
public static ImmutableAllConfig copyOf(AllConfig instance) {
if (instance instanceof ImmutableAllConfig) {
return (ImmutableAllConfig) instance;
}
return ImmutableAllConfig.builder()
.copyFrom(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableAllConfig ImmutableAllConfig}.
* @return A new ImmutableAllConfig builder
*/
public static ImmutableAllConfig.Builder builder() {
return new ImmutableAllConfig.Builder();
}
/**
* Builds instances of type {@link ImmutableAllConfig ImmutableAllConfig}.
* 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_TRANSACTION = 0x1L;
private static final long INIT_BIT_JVM = 0x2L;
private static final long INIT_BIT_UI_DEFAULTS = 0x4L;
private static final long INIT_BIT_USER_RECORDING = 0x8L;
private static final long INIT_BIT_ADVANCED = 0x10L;
private long initBits = 0x1fL;
private @Nullable TransactionConfig transaction;
private @Nullable JvmConfig jvm;
private @Nullable UiDefaultsConfig uiDefaults;
private @Nullable UserRecordingConfig userRecording;
private @Nullable AdvancedConfig advanced;
private ImmutableList.Builder gauges = ImmutableList.builder();
private ImmutableList.Builder syntheticMonitors = ImmutableList.builder();
private ImmutableList.Builder alerts = ImmutableList.builder();
private ImmutableList.Builder plugins = ImmutableList.builder();
private ImmutableList.Builder instrumentation = ImmutableList.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code AllConfig} 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
*/
@CanIgnoreReturnValue
public final Builder copyFrom(AllConfig instance) {
Preconditions.checkNotNull(instance, "instance");
transaction(instance.transaction());
jvm(instance.jvm());
uiDefaults(instance.uiDefaults());
userRecording(instance.userRecording());
advanced(instance.advanced());
addAllGauges(instance.gauges());
addAllSyntheticMonitors(instance.syntheticMonitors());
addAllAlerts(instance.alerts());
addAllPlugins(instance.plugins());
addAllInstrumentation(instance.instrumentation());
return this;
}
/**
* Initializes the value for the {@link AllConfig#transaction() transaction} attribute.
* @param transaction The value for transaction
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder transaction(TransactionConfig transaction) {
this.transaction = Preconditions.checkNotNull(transaction, "transaction");
initBits &= ~INIT_BIT_TRANSACTION;
return this;
}
/**
* Initializes the value for the {@link AllConfig#jvm() jvm} attribute.
* @param jvm The value for jvm
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder jvm(JvmConfig jvm) {
this.jvm = Preconditions.checkNotNull(jvm, "jvm");
initBits &= ~INIT_BIT_JVM;
return this;
}
/**
* Initializes the value for the {@link AllConfig#uiDefaults() uiDefaults} attribute.
* @param uiDefaults The value for uiDefaults
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder uiDefaults(UiDefaultsConfig uiDefaults) {
this.uiDefaults = Preconditions.checkNotNull(uiDefaults, "uiDefaults");
initBits &= ~INIT_BIT_UI_DEFAULTS;
return this;
}
/**
* Initializes the value for the {@link AllConfig#userRecording() userRecording} attribute.
* @param userRecording The value for userRecording
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder userRecording(UserRecordingConfig userRecording) {
this.userRecording = Preconditions.checkNotNull(userRecording, "userRecording");
initBits &= ~INIT_BIT_USER_RECORDING;
return this;
}
/**
* Initializes the value for the {@link AllConfig#advanced() advanced} attribute.
* @param advanced The value for advanced
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder advanced(AdvancedConfig advanced) {
this.advanced = Preconditions.checkNotNull(advanced, "advanced");
initBits &= ~INIT_BIT_ADVANCED;
return this;
}
/**
* Adds one element to {@link AllConfig#gauges() gauges} list.
* @param element A gauges element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addGauges(GaugeConfig element) {
this.gauges.add(element);
return this;
}
/**
* Adds elements to {@link AllConfig#gauges() gauges} list.
* @param elements An array of gauges elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addGauges(GaugeConfig... elements) {
this.gauges.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link AllConfig#gauges() gauges} list.
* @param elements An iterable of gauges elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder gauges(Iterable extends GaugeConfig> elements) {
this.gauges = ImmutableList.builder();
return addAllGauges(elements);
}
/**
* Adds elements to {@link AllConfig#gauges() gauges} list.
* @param elements An iterable of gauges elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllGauges(Iterable extends GaugeConfig> elements) {
this.gauges.addAll(elements);
return this;
}
/**
* Adds one element to {@link AllConfig#syntheticMonitors() syntheticMonitors} list.
* @param element A syntheticMonitors element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addSyntheticMonitors(SyntheticMonitorConfig element) {
this.syntheticMonitors.add(element);
return this;
}
/**
* Adds elements to {@link AllConfig#syntheticMonitors() syntheticMonitors} list.
* @param elements An array of syntheticMonitors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addSyntheticMonitors(SyntheticMonitorConfig... elements) {
this.syntheticMonitors.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link AllConfig#syntheticMonitors() syntheticMonitors} list.
* @param elements An iterable of syntheticMonitors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder syntheticMonitors(Iterable extends SyntheticMonitorConfig> elements) {
this.syntheticMonitors = ImmutableList.builder();
return addAllSyntheticMonitors(elements);
}
/**
* Adds elements to {@link AllConfig#syntheticMonitors() syntheticMonitors} list.
* @param elements An iterable of syntheticMonitors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllSyntheticMonitors(Iterable extends SyntheticMonitorConfig> elements) {
this.syntheticMonitors.addAll(elements);
return this;
}
/**
* Adds one element to {@link AllConfig#alerts() alerts} list.
* @param element A alerts element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAlerts(AlertConfig element) {
this.alerts.add(element);
return this;
}
/**
* Adds elements to {@link AllConfig#alerts() alerts} list.
* @param elements An array of alerts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAlerts(AlertConfig... elements) {
this.alerts.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link AllConfig#alerts() alerts} list.
* @param elements An iterable of alerts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder alerts(Iterable extends AlertConfig> elements) {
this.alerts = ImmutableList.builder();
return addAllAlerts(elements);
}
/**
* Adds elements to {@link AllConfig#alerts() alerts} list.
* @param elements An iterable of alerts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllAlerts(Iterable extends AlertConfig> elements) {
this.alerts.addAll(elements);
return this;
}
/**
* Adds one element to {@link AllConfig#plugins() plugins} list.
* @param element A plugins element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addPlugins(PluginConfig element) {
this.plugins.add(element);
return this;
}
/**
* Adds elements to {@link AllConfig#plugins() plugins} list.
* @param elements An array of plugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addPlugins(PluginConfig... elements) {
this.plugins.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link AllConfig#plugins() plugins} list.
* @param elements An iterable of plugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder plugins(Iterable extends PluginConfig> elements) {
this.plugins = ImmutableList.builder();
return addAllPlugins(elements);
}
/**
* Adds elements to {@link AllConfig#plugins() plugins} list.
* @param elements An iterable of plugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllPlugins(Iterable extends PluginConfig> elements) {
this.plugins.addAll(elements);
return this;
}
/**
* Adds one element to {@link AllConfig#instrumentation() instrumentation} list.
* @param element A instrumentation element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addInstrumentation(InstrumentationConfig element) {
this.instrumentation.add(element);
return this;
}
/**
* Adds elements to {@link AllConfig#instrumentation() instrumentation} list.
* @param elements An array of instrumentation elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addInstrumentation(InstrumentationConfig... elements) {
this.instrumentation.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link AllConfig#instrumentation() instrumentation} list.
* @param elements An iterable of instrumentation elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder instrumentation(Iterable extends InstrumentationConfig> elements) {
this.instrumentation = ImmutableList.builder();
return addAllInstrumentation(elements);
}
/**
* Adds elements to {@link AllConfig#instrumentation() instrumentation} list.
* @param elements An iterable of instrumentation elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllInstrumentation(Iterable extends InstrumentationConfig> elements) {
this.instrumentation.addAll(elements);
return this;
}
/**
* Builds a new {@link ImmutableAllConfig ImmutableAllConfig}.
* @return An immutable instance of AllConfig
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableAllConfig build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableAllConfig(
transaction,
jvm,
uiDefaults,
userRecording,
advanced,
gauges.build(),
syntheticMonitors.build(),
alerts.build(),
plugins.build(),
instrumentation.build());
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList();
if ((initBits & INIT_BIT_TRANSACTION) != 0) attributes.add("transaction");
if ((initBits & INIT_BIT_JVM) != 0) attributes.add("jvm");
if ((initBits & INIT_BIT_UI_DEFAULTS) != 0) attributes.add("uiDefaults");
if ((initBits & INIT_BIT_USER_RECORDING) != 0) attributes.add("userRecording");
if ((initBits & INIT_BIT_ADVANCED) != 0) attributes.add("advanced");
return "Cannot build AllConfig, some of required attributes are not set " + attributes;
}
}
}