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

com.neotys.neoload.model.v3.project.scenario.ImmutableApm Maven / Gradle / Ivy

package com.neotys.neoload.model.v3.project.scenario;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Objects;
import javax.annotation.CheckReturnValue;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.validation.Valid;

/**
 * Immutable implementation of {@link Apm}.
 * 

* Use the builder to create immutable instances: * {@code new Apm.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "Apm"}) @Immutable @CheckReturnValue public final class ImmutableApm implements Apm { private final ImmutableList dynatraceTags; private final ImmutableList dynatraceAnomalyRules; private ImmutableApm( ImmutableList dynatraceTags, ImmutableList dynatraceAnomalyRules) { this.dynatraceTags = dynatraceTags; this.dynatraceAnomalyRules = dynatraceAnomalyRules; } /** * @return The value of the {@code dynatraceTags} attribute */ @JsonProperty("dynatrace_tags") @Override public ImmutableList getDynatraceTags() { return dynatraceTags; } /** * @return The value of the {@code dynatraceAnomalyRules} attribute */ @JsonProperty("dynatrace_anomaly_rules") @Override public ImmutableList getDynatraceAnomalyRules() { return dynatraceAnomalyRules; } /** * Copy the current immutable object with elements that replace the content of {@link Apm#getDynatraceTags() dynatraceTags}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableApm withDynatraceTags(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableApm(newValue, this.dynatraceAnomalyRules); } /** * Copy the current immutable object with elements that replace the content of {@link Apm#getDynatraceTags() dynatraceTags}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of dynatraceTags elements to set * @return A modified copy of {@code this} object */ public final ImmutableApm withDynatraceTags(Iterable elements) { if (this.dynatraceTags == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableApm(newValue, this.dynatraceAnomalyRules); } /** * Copy the current immutable object with elements that replace the content of {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableApm withDynatraceAnomalyRules(DynatraceAnomalyRule... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableApm(this.dynatraceTags, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of dynatraceAnomalyRules elements to set * @return A modified copy of {@code this} object */ public final ImmutableApm withDynatraceAnomalyRules(Iterable elements) { if (this.dynatraceAnomalyRules == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableApm(this.dynatraceTags, newValue); } /** * This instance is equal to all instances of {@code ImmutableApm} 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 ImmutableApm && equalTo((ImmutableApm) another); } private boolean equalTo(ImmutableApm another) { return dynatraceTags.equals(another.dynatraceTags) && dynatraceAnomalyRules.equals(another.dynatraceAnomalyRules); } /** * Computes a hash code from attributes: {@code dynatraceTags}, {@code dynatraceAnomalyRules}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + dynatraceTags.hashCode(); h += (h << 5) + dynatraceAnomalyRules.hashCode(); return h; } /** * Prints the immutable value {@code Apm} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("Apm") .omitNullValues() .add("dynatraceTags", dynatraceTags) .add("dynatraceAnomalyRules", dynatraceAnomalyRules) .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 @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements Apm { java.util.List dynatraceTags = ImmutableList.of(); java.util.@Valid List dynatraceAnomalyRules = ImmutableList.of(); @JsonProperty("dynatrace_tags") public void setDynatraceTags(java.util.List dynatraceTags) { this.dynatraceTags = dynatraceTags; } @JsonProperty("dynatrace_anomaly_rules") public void setDynatraceAnomalyRules(java.util.@Valid List dynatraceAnomalyRules) { this.dynatraceAnomalyRules = dynatraceAnomalyRules; } @Override public java.util.List getDynatraceTags() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getDynatraceAnomalyRules() { 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 ImmutableApm fromJson(Json json) { Apm.Builder builder = new Apm.Builder(); if (json.dynatraceTags != null) { builder.addAllDynatraceTags(json.dynatraceTags); } if (json.dynatraceAnomalyRules != null) { builder.addAllDynatraceAnomalyRules(json.dynatraceAnomalyRules); } return (ImmutableApm) builder.build(); } /** * Creates an immutable copy of a {@link Apm} 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 Apm instance */ public static ImmutableApm copyOf(Apm instance) { if (instance instanceof ImmutableApm) { return (ImmutableApm) instance; } return new Apm.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableApm ImmutableApm}. * 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 class Builder { private ImmutableList.Builder dynatraceTags = ImmutableList.builder(); private ImmutableList.Builder dynatraceAnomalyRules = ImmutableList.builder(); /** * Creates a builder for {@link ImmutableApm ImmutableApm} instances. */ public Builder() { if (!(this instanceof Apm.Builder)) { throw new UnsupportedOperationException("Use: new Apm.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code Apm} 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 Apm.Builder from(Apm instance) { Objects.requireNonNull(instance, "instance"); addAllDynatraceTags(instance.getDynatraceTags()); addAllDynatraceAnomalyRules(instance.getDynatraceAnomalyRules()); return (Apm.Builder) this; } /** * Adds one element to {@link Apm#getDynatraceTags() dynatraceTags} list. * @param element A dynatraceTags element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addDynatraceTags(String element) { this.dynatraceTags.add(element); return (Apm.Builder) this; } /** * Adds elements to {@link Apm#getDynatraceTags() dynatraceTags} list. * @param elements An array of dynatraceTags elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addDynatraceTags(String... elements) { this.dynatraceTags.add(elements); return (Apm.Builder) this; } /** * Sets or replaces all elements for {@link Apm#getDynatraceTags() dynatraceTags} list. * @param elements An iterable of dynatraceTags elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("dynatrace_tags") public final Apm.Builder dynatraceTags(Iterable elements) { this.dynatraceTags = ImmutableList.builder(); return addAllDynatraceTags(elements); } /** * Adds elements to {@link Apm#getDynatraceTags() dynatraceTags} list. * @param elements An iterable of dynatraceTags elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addAllDynatraceTags(Iterable elements) { this.dynatraceTags.addAll(elements); return (Apm.Builder) this; } /** * Adds one element to {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules} list. * @param element A dynatraceAnomalyRules element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addDynatraceAnomalyRules(DynatraceAnomalyRule element) { this.dynatraceAnomalyRules.add(element); return (Apm.Builder) this; } /** * Adds elements to {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules} list. * @param elements An array of dynatraceAnomalyRules elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addDynatraceAnomalyRules(DynatraceAnomalyRule... elements) { this.dynatraceAnomalyRules.add(elements); return (Apm.Builder) this; } /** * Sets or replaces all elements for {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules} list. * @param elements An iterable of dynatraceAnomalyRules elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("dynatrace_anomaly_rules") public final Apm.Builder dynatraceAnomalyRules(Iterable elements) { this.dynatraceAnomalyRules = ImmutableList.builder(); return addAllDynatraceAnomalyRules(elements); } /** * Adds elements to {@link Apm#getDynatraceAnomalyRules() dynatraceAnomalyRules} list. * @param elements An iterable of dynatraceAnomalyRules elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Apm.Builder addAllDynatraceAnomalyRules(Iterable elements) { this.dynatraceAnomalyRules.addAll(elements); return (Apm.Builder) this; } /** * Builds a new {@link ImmutableApm ImmutableApm}. * @return An immutable instance of Apm * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableApm build() { return new ImmutableApm(dynatraceTags.build(), dynatraceAnomalyRules.build()); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy