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

com.neotys.neoload.model.v3.project.scenario.ImmutableStartAfter 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.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;

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

* Use the builder to create immutable instances: * {@code new StartAfter.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "StartAfter"}) @Immutable @CheckReturnValue public final class ImmutableStartAfter implements StartAfter { private final Object value; private final StartAfter.Type type; private ImmutableStartAfter(Object value, StartAfter.Type type) { this.value = value; this.type = type; } /** * @return The value of the {@code value} attribute */ @JsonProperty("value") @Override public Object getValue() { return value; } /** * @return The value of the {@code type} attribute */ @JsonProperty("type") @Override public StartAfter.Type getType() { return type; } /** * Copy the current immutable object by setting a value for the {@link StartAfter#getValue() value} 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 value (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableStartAfter withValue(Object value) { if (this.value == value) return this; return new ImmutableStartAfter(value, this.type); } /** * Copy the current immutable object by setting a value for the {@link StartAfter#getType() type} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for type (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableStartAfter withType(StartAfter.Type value) { if (this.type == value) return this; return new ImmutableStartAfter(this.value, value); } /** * This instance is equal to all instances of {@code ImmutableStartAfter} 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 ImmutableStartAfter && equalTo((ImmutableStartAfter) another); } private boolean equalTo(ImmutableStartAfter another) { return Objects.equals(value, another.value) && Objects.equals(type, another.type); } /** * Computes a hash code from attributes: {@code value}, {@code type}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(value); h += (h << 5) + Objects.hashCode(type); return h; } /** * Prints the immutable value {@code StartAfter} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("StartAfter") .omitNullValues() .add("value", value) .add("type", type) .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 StartAfter { @Nullable Object value; @Nullable StartAfter.Type type; @JsonProperty("value") public void setValue(Object value) { this.value = value; } @JsonProperty("type") public void setType(StartAfter.Type type) { this.type = type; } @Override public Object getValue() { throw new UnsupportedOperationException(); } @Override public StartAfter.Type getType() { 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 ImmutableStartAfter fromJson(Json json) { StartAfter.Builder builder = new StartAfter.Builder(); if (json.value != null) { builder.value(json.value); } if (json.type != null) { builder.type(json.type); } return (ImmutableStartAfter) builder.build(); } /** * Creates an immutable copy of a {@link StartAfter} 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 StartAfter instance */ public static ImmutableStartAfter copyOf(StartAfter instance) { if (instance instanceof ImmutableStartAfter) { return (ImmutableStartAfter) instance; } return new StartAfter.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableStartAfter ImmutableStartAfter}. * 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 Object value; private @Nullable StartAfter.Type type; /** * Creates a builder for {@link ImmutableStartAfter ImmutableStartAfter} instances. */ public Builder() { if (!(this instanceof StartAfter.Builder)) { throw new UnsupportedOperationException("Use: new StartAfter.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code StartAfter} 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 StartAfter.Builder from(StartAfter instance) { Objects.requireNonNull(instance, "instance"); Object valueValue = instance.getValue(); if (valueValue != null) { value(valueValue); } StartAfter.Type typeValue = instance.getType(); if (typeValue != null) { type(typeValue); } return (StartAfter.Builder) this; } /** * Initializes the value for the {@link StartAfter#getValue() value} attribute. * @param value The value for value (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("value") public final StartAfter.Builder value(Object value) { this.value = value; return (StartAfter.Builder) this; } /** * Initializes the value for the {@link StartAfter#getType() type} attribute. * @param type The value for type (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("type") public final StartAfter.Builder type(StartAfter.Type type) { this.type = type; return (StartAfter.Builder) this; } /** * Builds a new {@link ImmutableStartAfter ImmutableStartAfter}. * @return An immutable instance of StartAfter * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableStartAfter build() { return new ImmutableStartAfter(value, type); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy