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

com.neotys.neoload.model.v3.project.sla.ImmutableSlaThresholdCondition Maven / Gradle / Ivy

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

import com.google.common.base.MoreObjects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.validation.groups.NeoLoad;
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.constraints.PositiveOrZero;

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

* Use the builder to create immutable instances: * {@code new SlaThresholdCondition.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "SlaThresholdCondition"}) @Immutable @CheckReturnValue public final class ImmutableSlaThresholdCondition implements SlaThresholdCondition { private final SlaThresholdCondition.Severity severity; private final SlaThresholdCondition.Operator operator; private final java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double value; private ImmutableSlaThresholdCondition( SlaThresholdCondition.Severity severity, SlaThresholdCondition.Operator operator, java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double value) { this.severity = severity; this.operator = operator; this.value = value; } /** * @return The value of the {@code severity} attribute */ @Override public SlaThresholdCondition.Severity getSeverity() { return severity; } /** * @return The value of the {@code operator} attribute */ @Override public SlaThresholdCondition.Operator getOperator() { return operator; } /** * @return The value of the {@code value} attribute */ @Override public java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double getValue() { return value; } /** * Copy the current immutable object by setting a value for the {@link SlaThresholdCondition#getSeverity() severity} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for severity (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableSlaThresholdCondition withSeverity(SlaThresholdCondition.Severity value) { if (this.severity == value) return this; return new ImmutableSlaThresholdCondition(value, this.operator, this.value); } /** * Copy the current immutable object by setting a value for the {@link SlaThresholdCondition#getOperator() operator} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for operator (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableSlaThresholdCondition withOperator(SlaThresholdCondition.Operator value) { if (this.operator == value) return this; return new ImmutableSlaThresholdCondition(this.severity, value, this.value); } /** * Copy the current immutable object by setting a value for the {@link SlaThresholdCondition#getValue() value} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for value (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableSlaThresholdCondition withValue(java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double value) { if (Objects.equals(this.value, value)) return this; return new ImmutableSlaThresholdCondition(this.severity, this.operator, value); } /** * This instance is equal to all instances of {@code ImmutableSlaThresholdCondition} 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 ImmutableSlaThresholdCondition && equalTo((ImmutableSlaThresholdCondition) another); } private boolean equalTo(ImmutableSlaThresholdCondition another) { return Objects.equals(severity, another.severity) && Objects.equals(operator, another.operator) && Objects.equals(value, another.value); } /** * Computes a hash code from attributes: {@code severity}, {@code operator}, {@code value}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(severity); h += (h << 5) + Objects.hashCode(operator); h += (h << 5) + Objects.hashCode(value); return h; } /** * Prints the immutable value {@code SlaThresholdCondition} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("SlaThresholdCondition") .omitNullValues() .add("severity", severity) .add("operator", operator) .add("value", value) .toString(); } /** * Creates an immutable copy of a {@link SlaThresholdCondition} 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 SlaThresholdCondition instance */ public static ImmutableSlaThresholdCondition copyOf(SlaThresholdCondition instance) { if (instance instanceof ImmutableSlaThresholdCondition) { return (ImmutableSlaThresholdCondition) instance; } return new SlaThresholdCondition.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableSlaThresholdCondition ImmutableSlaThresholdCondition}. * 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 @Nullable SlaThresholdCondition.Severity severity; private @Nullable SlaThresholdCondition.Operator operator; private @Nullable java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double value; /** * Creates a builder for {@link ImmutableSlaThresholdCondition ImmutableSlaThresholdCondition} instances. */ public Builder() { if (!(this instanceof SlaThresholdCondition.Builder)) { throw new UnsupportedOperationException("Use: new SlaThresholdCondition.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code SlaThresholdCondition} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final SlaThresholdCondition.Builder from(SlaThresholdCondition instance) { Objects.requireNonNull(instance, "instance"); SlaThresholdCondition.Severity severityValue = instance.getSeverity(); if (severityValue != null) { severity(severityValue); } SlaThresholdCondition.Operator operatorValue = instance.getOperator(); if (operatorValue != null) { operator(operatorValue); } java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double valueValue = instance.getValue(); if (valueValue != null) { value(valueValue); } return (SlaThresholdCondition.Builder) this; } /** * Initializes the value for the {@link SlaThresholdCondition#getSeverity() severity} attribute. * @param severity The value for severity (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final SlaThresholdCondition.Builder severity(SlaThresholdCondition.Severity severity) { this.severity = severity; return (SlaThresholdCondition.Builder) this; } /** * Initializes the value for the {@link SlaThresholdCondition#getOperator() operator} attribute. * @param operator The value for operator (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final SlaThresholdCondition.Builder operator(SlaThresholdCondition.Operator operator) { this.operator = operator; return (SlaThresholdCondition.Builder) this; } /** * Initializes the value for the {@link SlaThresholdCondition#getValue() value} attribute. * @param value The value for value (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final SlaThresholdCondition.Builder value(java.lang.@PositiveOrZero(groups = {NeoLoad.class}) Double value) { this.value = value; return (SlaThresholdCondition.Builder) this; } /** * Builds a new {@link ImmutableSlaThresholdCondition ImmutableSlaThresholdCondition}. * @return An immutable instance of SlaThresholdCondition * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSlaThresholdCondition build() { return new ImmutableSlaThresholdCondition(severity, operator, value); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy