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

com.neotys.neoload.model.v3.project.variable.ImmutableFileVariable Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.primitives.Booleans;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.project.Element;
import com.neotys.neoload.model.v3.validation.constraints.RangeCheck;
import com.neotys.neoload.model.v3.validation.groups.NeoLoad;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
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.Size;

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

* Use the builder to create immutable instances: * {@code new FileVariable.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "FileVariable"}) @Immutable @CheckReturnValue public final class ImmutableFileVariable implements FileVariable { private final ImmutableList columnNames; private final boolean isFirstLineColumnNames; private final @RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine; private final java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter; private final String path; private final Variable.ChangePolicy changePolicy; private final Variable.Scope scope; private final Variable.Order order; private final Variable.OutOfValue outOfValue; private final String name; private final @Nullable String description; private ImmutableFileVariable(ImmutableFileVariable.Builder builder) { this.columnNames = builder.columnNames.build(); this.path = builder.path; this.name = builder.name; this.description = builder.description; if (builder.isFirstLineColumnNamesIsSet()) { initShim.isFirstLineColumnNames(builder.isFirstLineColumnNames); } if (builder.startFromLineIsSet()) { initShim.startFromLine(builder.startFromLine); } if (builder.delimiter != null) { initShim.delimiter(builder.delimiter); } if (builder.changePolicy != null) { initShim.changePolicy(builder.changePolicy); } if (builder.scope != null) { initShim.scope(builder.scope); } if (builder.order != null) { initShim.order(builder.order); } if (builder.outOfValue != null) { initShim.outOfValue(builder.outOfValue); } this.isFirstLineColumnNames = initShim.isFirstLineColumnNames(); this.startFromLine = initShim.getStartFromLine(); this.delimiter = initShim.getDelimiter(); this.changePolicy = initShim.getChangePolicy(); this.scope = initShim.getScope(); this.order = initShim.getOrder(); this.outOfValue = initShim.getOutOfValue(); this.initShim = null; } private ImmutableFileVariable( ImmutableList columnNames, boolean isFirstLineColumnNames, @RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine, java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter, String path, Variable.ChangePolicy changePolicy, Variable.Scope scope, Variable.Order order, Variable.OutOfValue outOfValue, String name, @Nullable String description) { this.columnNames = columnNames; this.isFirstLineColumnNames = isFirstLineColumnNames; this.startFromLine = startFromLine; this.delimiter = delimiter; this.path = path; this.changePolicy = changePolicy; this.scope = scope; this.order = order; this.outOfValue = outOfValue; this.name = name; this.description = description; 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 transient volatile InitShim initShim = new InitShim(); private final class InitShim { private boolean isFirstLineColumnNames; private int isFirstLineColumnNamesBuildStage; boolean isFirstLineColumnNames() { if (isFirstLineColumnNamesBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (isFirstLineColumnNamesBuildStage == STAGE_UNINITIALIZED) { isFirstLineColumnNamesBuildStage = STAGE_INITIALIZING; this.isFirstLineColumnNames = isFirstLineColumnNamesInitialize(); isFirstLineColumnNamesBuildStage = STAGE_INITIALIZED; } return this.isFirstLineColumnNames; } void isFirstLineColumnNames(boolean isFirstLineColumnNames) { this.isFirstLineColumnNames = isFirstLineColumnNames; isFirstLineColumnNamesBuildStage = STAGE_INITIALIZED; } private @RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine; private int startFromLineBuildStage; @RangeCheck(min = 1, groups = {NeoLoad.class}) int getStartFromLine() { if (startFromLineBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (startFromLineBuildStage == STAGE_UNINITIALIZED) { startFromLineBuildStage = STAGE_INITIALIZING; this.startFromLine = getStartFromLineInitialize(); startFromLineBuildStage = STAGE_INITIALIZED; } return this.startFromLine; } void startFromLine(@RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine) { this.startFromLine = startFromLine; startFromLineBuildStage = STAGE_INITIALIZED; } private java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter; private int delimiterBuildStage; java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String getDelimiter() { if (delimiterBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (delimiterBuildStage == STAGE_UNINITIALIZED) { delimiterBuildStage = STAGE_INITIALIZING; this.delimiter = Objects.requireNonNull(getDelimiterInitialize(), "delimiter"); delimiterBuildStage = STAGE_INITIALIZED; } return this.delimiter; } void delimiter(java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter) { this.delimiter = delimiter; delimiterBuildStage = STAGE_INITIALIZED; } private Variable.ChangePolicy changePolicy; private int changePolicyBuildStage; Variable.ChangePolicy getChangePolicy() { if (changePolicyBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (changePolicyBuildStage == STAGE_UNINITIALIZED) { changePolicyBuildStage = STAGE_INITIALIZING; this.changePolicy = Objects.requireNonNull(getChangePolicyInitialize(), "changePolicy"); changePolicyBuildStage = STAGE_INITIALIZED; } return this.changePolicy; } void changePolicy(Variable.ChangePolicy changePolicy) { this.changePolicy = changePolicy; changePolicyBuildStage = STAGE_INITIALIZED; } private Variable.Scope scope; private int scopeBuildStage; Variable.Scope getScope() { if (scopeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (scopeBuildStage == STAGE_UNINITIALIZED) { scopeBuildStage = STAGE_INITIALIZING; this.scope = Objects.requireNonNull(getScopeInitialize(), "scope"); scopeBuildStage = STAGE_INITIALIZED; } return this.scope; } void scope(Variable.Scope scope) { this.scope = scope; scopeBuildStage = STAGE_INITIALIZED; } private Variable.Order order; private int orderBuildStage; Variable.Order getOrder() { if (orderBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (orderBuildStage == STAGE_UNINITIALIZED) { orderBuildStage = STAGE_INITIALIZING; this.order = Objects.requireNonNull(getOrderInitialize(), "order"); orderBuildStage = STAGE_INITIALIZED; } return this.order; } void order(Variable.Order order) { this.order = order; orderBuildStage = STAGE_INITIALIZED; } private Variable.OutOfValue outOfValue; private int outOfValueBuildStage; Variable.OutOfValue getOutOfValue() { if (outOfValueBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (outOfValueBuildStage == STAGE_UNINITIALIZED) { outOfValueBuildStage = STAGE_INITIALIZING; this.outOfValue = Objects.requireNonNull(getOutOfValueInitialize(), "outOfValue"); outOfValueBuildStage = STAGE_INITIALIZED; } return this.outOfValue; } void outOfValue(Variable.OutOfValue outOfValue) { this.outOfValue = outOfValue; outOfValueBuildStage = STAGE_INITIALIZED; } private String formatInitCycleMessage() { ArrayList attributes = Lists.newArrayList(); if (isFirstLineColumnNamesBuildStage == STAGE_INITIALIZING) attributes.add("isFirstLineColumnNames"); if (startFromLineBuildStage == STAGE_INITIALIZING) attributes.add("startFromLine"); if (delimiterBuildStage == STAGE_INITIALIZING) attributes.add("delimiter"); if (changePolicyBuildStage == STAGE_INITIALIZING) attributes.add("changePolicy"); if (scopeBuildStage == STAGE_INITIALIZING) attributes.add("scope"); if (orderBuildStage == STAGE_INITIALIZING) attributes.add("order"); if (outOfValueBuildStage == STAGE_INITIALIZING) attributes.add("outOfValue"); return "Cannot build FileVariable, attribute initializers form cycle" + attributes; } } private boolean isFirstLineColumnNamesInitialize() { return FileVariable.super.isFirstLineColumnNames(); } private @RangeCheck(min = 1, groups = {NeoLoad.class}) int getStartFromLineInitialize() { return FileVariable.super.getStartFromLine(); } private java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String getDelimiterInitialize() { return FileVariable.super.getDelimiter(); } private Variable.ChangePolicy getChangePolicyInitialize() { return FileVariable.super.getChangePolicy(); } private Variable.Scope getScopeInitialize() { return FileVariable.super.getScope(); } private Variable.Order getOrderInitialize() { return FileVariable.super.getOrder(); } private Variable.OutOfValue getOutOfValueInitialize() { return FileVariable.super.getOutOfValue(); } /** * @return The value of the {@code columnNames} attribute */ @JsonProperty("column_names") @Override public ImmutableList getColumnNames() { return columnNames; } /** * @return The value of the {@code isFirstLineColumnNames} attribute */ @JsonProperty("is_first_line_column_names") @Override public boolean isFirstLineColumnNames() { InitShim shim = this.initShim; return shim != null ? shim.isFirstLineColumnNames() : this.isFirstLineColumnNames; } /** * @return The value of the {@code startFromLine} attribute */ @JsonProperty("start_from_line") @Override public @RangeCheck(min = 1, groups = {NeoLoad.class}) int getStartFromLine() { InitShim shim = this.initShim; return shim != null ? shim.getStartFromLine() : this.startFromLine; } /** * @return The value of the {@code delimiter} attribute */ @JsonProperty("delimiter") @Override public java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String getDelimiter() { InitShim shim = this.initShim; return shim != null ? shim.getDelimiter() : this.delimiter; } /** * @return The value of the {@code path} attribute */ @JsonProperty("path") @Override public String getPath() { return path; } /** * @return The value of the {@code changePolicy} attribute */ @JsonProperty("change_policy") @Override public Variable.ChangePolicy getChangePolicy() { InitShim shim = this.initShim; return shim != null ? shim.getChangePolicy() : this.changePolicy; } /** * @return The value of the {@code scope} attribute */ @JsonProperty("scope") @Override public Variable.Scope getScope() { InitShim shim = this.initShim; return shim != null ? shim.getScope() : this.scope; } /** * @return The value of the {@code order} attribute */ @JsonProperty("order") @Override public Variable.Order getOrder() { InitShim shim = this.initShim; return shim != null ? shim.getOrder() : this.order; } /** * @return The value of the {@code outOfValue} attribute */ @JsonProperty("out_of_value") @Override public Variable.OutOfValue getOutOfValue() { InitShim shim = this.initShim; return shim != null ? shim.getOutOfValue() : this.outOfValue; } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public String getName() { return name; } /** * @return The value of the {@code description} attribute */ @JsonProperty("description") @Override public Optional getDescription() { return Optional.ofNullable(description); } /** * Copy the current immutable object with elements that replace the content of {@link FileVariable#getColumnNames() columnNames}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableFileVariable withColumnNames(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableFileVariable( newValue, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object with elements that replace the content of {@link FileVariable#getColumnNames() columnNames}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of columnNames elements to set * @return A modified copy of {@code this} object */ public final ImmutableFileVariable withColumnNames(Iterable elements) { if (this.columnNames == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableFileVariable( newValue, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#isFirstLineColumnNames() isFirstLineColumnNames} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for isFirstLineColumnNames * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withIsFirstLineColumnNames(boolean value) { if (this.isFirstLineColumnNames == value) return this; return new ImmutableFileVariable( this.columnNames, value, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getStartFromLine() startFromLine} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for startFromLine * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withStartFromLine(@RangeCheck(min = 1, groups = {NeoLoad.class}) int value) { if (this.startFromLine == value) return this; return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, value, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getDelimiter() delimiter} 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 delimiter * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withDelimiter(java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String value) { if (this.delimiter == value) return this; java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String newValue = Objects.requireNonNull(value, "delimiter"); return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, newValue, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getPath() path} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for path (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withPath(String value) { if (Objects.equals(this.path, value)) return this; return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, value, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getChangePolicy() changePolicy} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for changePolicy * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withChangePolicy(Variable.ChangePolicy value) { if (this.changePolicy == value) return this; Variable.ChangePolicy newValue = Objects.requireNonNull(value, "changePolicy"); return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, newValue, this.scope, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getScope() scope} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for scope * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withScope(Variable.Scope value) { if (this.scope == value) return this; Variable.Scope newValue = Objects.requireNonNull(value, "scope"); return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, newValue, this.order, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getOrder() order} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for order * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withOrder(Variable.Order value) { if (this.order == value) return this; Variable.Order newValue = Objects.requireNonNull(value, "order"); return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, newValue, this.outOfValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getOutOfValue() outOfValue} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for outOfValue * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withOutOfValue(Variable.OutOfValue value) { if (this.outOfValue == value) return this; Variable.OutOfValue newValue = Objects.requireNonNull(value, "outOfValue"); return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, newValue, this.name, this.description); } /** * Copy the current immutable object by setting a value for the {@link FileVariable#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableFileVariable withName(String value) { if (Objects.equals(this.name, value)) return this; return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, value, this.description); } /** * Copy the current immutable object by setting a present value for the optional {@link FileVariable#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableFileVariable withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link FileVariable#getDescription() description} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for description * @return A modified copy of {@code this} object */ public final ImmutableFileVariable withDescription(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableFileVariable( this.columnNames, this.isFirstLineColumnNames, this.startFromLine, this.delimiter, this.path, this.changePolicy, this.scope, this.order, this.outOfValue, this.name, value); } /** * This instance is equal to all instances of {@code ImmutableFileVariable} 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 ImmutableFileVariable && equalTo((ImmutableFileVariable) another); } private boolean equalTo(ImmutableFileVariable another) { return columnNames.equals(another.columnNames) && isFirstLineColumnNames == another.isFirstLineColumnNames && startFromLine == another.startFromLine && delimiter.equals(another.delimiter) && Objects.equals(path, another.path) && changePolicy.equals(another.changePolicy) && scope.equals(another.scope) && order.equals(another.order) && outOfValue.equals(another.outOfValue) && Objects.equals(name, another.name) && Objects.equals(description, another.description); } /** * Computes a hash code from attributes: {@code columnNames}, {@code isFirstLineColumnNames}, {@code startFromLine}, {@code delimiter}, {@code path}, {@code changePolicy}, {@code scope}, {@code order}, {@code outOfValue}, {@code name}, {@code description}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + columnNames.hashCode(); h += (h << 5) + Booleans.hashCode(isFirstLineColumnNames); h += (h << 5) + startFromLine; h += (h << 5) + delimiter.hashCode(); h += (h << 5) + Objects.hashCode(path); h += (h << 5) + changePolicy.hashCode(); h += (h << 5) + scope.hashCode(); h += (h << 5) + order.hashCode(); h += (h << 5) + outOfValue.hashCode(); h += (h << 5) + Objects.hashCode(name); h += (h << 5) + Objects.hashCode(description); return h; } /** * Prints the immutable value {@code FileVariable} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("FileVariable") .omitNullValues() .add("columnNames", columnNames) .add("isFirstLineColumnNames", isFirstLineColumnNames) .add("startFromLine", startFromLine) .add("delimiter", delimiter) .add("path", path) .add("changePolicy", changePolicy) .add("scope", scope) .add("order", order) .add("outOfValue", outOfValue) .add("name", name) .add("description", description) .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 @JsonTypeInfo(use=JsonTypeInfo.Id.NONE) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements FileVariable { List columnNames = ImmutableList.of(); boolean isFirstLineColumnNames; boolean isFirstLineColumnNamesIsSet; @RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine; boolean startFromLineIsSet; @Nullable java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter; @Nullable String path; @Nullable Variable.ChangePolicy changePolicy; @Nullable Variable.Scope scope; @Nullable Variable.Order order; @Nullable Variable.OutOfValue outOfValue; @Nullable String name; Optional description = Optional.empty(); @JsonProperty("column_names") public void setColumnNames(List columnNames) { this.columnNames = columnNames; } @JsonProperty("is_first_line_column_names") public void setIsFirstLineColumnNames(boolean isFirstLineColumnNames) { this.isFirstLineColumnNames = isFirstLineColumnNames; this.isFirstLineColumnNamesIsSet = true; } @JsonProperty("start_from_line") public void setStartFromLine(@RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine) { this.startFromLine = startFromLine; this.startFromLineIsSet = true; } @JsonProperty("delimiter") public void setDelimiter(java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter) { this.delimiter = delimiter; } @JsonProperty("path") public void setPath(String path) { this.path = path; } @JsonProperty("change_policy") public void setChangePolicy(Variable.ChangePolicy changePolicy) { this.changePolicy = changePolicy; } @JsonProperty("scope") public void setScope(Variable.Scope scope) { this.scope = scope; } @JsonProperty("order") public void setOrder(Variable.Order order) { this.order = order; } @JsonProperty("out_of_value") public void setOutOfValue(Variable.OutOfValue outOfValue) { this.outOfValue = outOfValue; } @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("description") public void setDescription(Optional description) { this.description = description; } @Override public Element withName(String of) { throw new UnsupportedOperationException(); } @Override public List getColumnNames() { throw new UnsupportedOperationException(); } @Override public boolean isFirstLineColumnNames() { throw new UnsupportedOperationException(); } @Override public @RangeCheck(min = 1, groups = {NeoLoad.class}) int getStartFromLine() { throw new UnsupportedOperationException(); } @Override public java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String getDelimiter() { throw new UnsupportedOperationException(); } @Override public String getPath() { throw new UnsupportedOperationException(); } @Override public Variable.ChangePolicy getChangePolicy() { throw new UnsupportedOperationException(); } @Override public Variable.Scope getScope() { throw new UnsupportedOperationException(); } @Override public Variable.Order getOrder() { throw new UnsupportedOperationException(); } @Override public Variable.OutOfValue getOutOfValue() { throw new UnsupportedOperationException(); } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public Optional getDescription() { 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 ImmutableFileVariable fromJson(Json json) { FileVariable.Builder builder = new FileVariable.Builder(); if (json.columnNames != null) { builder.addAllColumnNames(json.columnNames); } if (json.isFirstLineColumnNamesIsSet) { builder.isFirstLineColumnNames(json.isFirstLineColumnNames); } if (json.startFromLineIsSet) { builder.startFromLine(json.startFromLine); } if (json.delimiter != null) { builder.delimiter(json.delimiter); } if (json.path != null) { builder.path(json.path); } if (json.changePolicy != null) { builder.changePolicy(json.changePolicy); } if (json.scope != null) { builder.scope(json.scope); } if (json.order != null) { builder.order(json.order); } if (json.outOfValue != null) { builder.outOfValue(json.outOfValue); } if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } return (ImmutableFileVariable) builder.build(); } /** * Creates an immutable copy of a {@link FileVariable} 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 FileVariable instance */ public static ImmutableFileVariable copyOf(FileVariable instance) { if (instance instanceof ImmutableFileVariable) { return (ImmutableFileVariable) instance; } return new FileVariable.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableFileVariable ImmutableFileVariable}. * 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 static final long OPT_BIT_IS_FIRST_LINE_COLUMN_NAMES = 0x1L; private static final long OPT_BIT_START_FROM_LINE = 0x2L; private long optBits; private ImmutableList.Builder columnNames = ImmutableList.builder(); private boolean isFirstLineColumnNames; private @RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine; private @Nullable java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter; private @Nullable String path; private @Nullable Variable.ChangePolicy changePolicy; private @Nullable Variable.Scope scope; private @Nullable Variable.Order order; private @Nullable Variable.OutOfValue outOfValue; private @Nullable String name; private @Nullable String description; /** * Creates a builder for {@link ImmutableFileVariable ImmutableFileVariable} instances. */ public Builder() { if (!(this instanceof FileVariable.Builder)) { throw new UnsupportedOperationException("Use: new FileVariable.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.variable.FileVariable} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder from(FileVariable instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (FileVariable.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.Element} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder from(Element instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (FileVariable.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.variable.Variable} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder from(Variable instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (FileVariable.Builder) this; } private void from(Object object) { if (object instanceof FileVariable) { FileVariable instance = (FileVariable) object; String pathValue = instance.getPath(); if (pathValue != null) { path(pathValue); } addAllColumnNames(instance.getColumnNames()); delimiter(instance.getDelimiter()); isFirstLineColumnNames(instance.isFirstLineColumnNames()); startFromLine(instance.getStartFromLine()); } if (object instanceof Element) { Element instance = (Element) object; String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } if (object instanceof Variable) { Variable instance = (Variable) object; changePolicy(instance.getChangePolicy()); scope(instance.getScope()); outOfValue(instance.getOutOfValue()); order(instance.getOrder()); } } /** * Adds one element to {@link FileVariable#getColumnNames() columnNames} list. * @param element A columnNames element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder addColumnNames(String element) { this.columnNames.add(element); return (FileVariable.Builder) this; } /** * Adds elements to {@link FileVariable#getColumnNames() columnNames} list. * @param elements An array of columnNames elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder addColumnNames(String... elements) { this.columnNames.add(elements); return (FileVariable.Builder) this; } /** * Sets or replaces all elements for {@link FileVariable#getColumnNames() columnNames} list. * @param elements An iterable of columnNames elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("column_names") public final FileVariable.Builder columnNames(Iterable elements) { this.columnNames = ImmutableList.builder(); return addAllColumnNames(elements); } /** * Adds elements to {@link FileVariable#getColumnNames() columnNames} list. * @param elements An iterable of columnNames elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder addAllColumnNames(Iterable elements) { this.columnNames.addAll(elements); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#isFirstLineColumnNames() isFirstLineColumnNames} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#isFirstLineColumnNames() isFirstLineColumnNames}. * @param isFirstLineColumnNames The value for isFirstLineColumnNames * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("is_first_line_column_names") public final FileVariable.Builder isFirstLineColumnNames(boolean isFirstLineColumnNames) { this.isFirstLineColumnNames = isFirstLineColumnNames; optBits |= OPT_BIT_IS_FIRST_LINE_COLUMN_NAMES; return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getStartFromLine() startFromLine} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getStartFromLine() startFromLine}. * @param startFromLine The value for startFromLine * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("start_from_line") public final FileVariable.Builder startFromLine(@RangeCheck(min = 1, groups = {NeoLoad.class}) int startFromLine) { this.startFromLine = startFromLine; optBits |= OPT_BIT_START_FROM_LINE; return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getDelimiter() delimiter} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getDelimiter() delimiter}. * @param delimiter The value for delimiter * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("delimiter") public final FileVariable.Builder delimiter(java.lang.@Size(min = 1, max = 1, groups = {NeoLoad.class}) String delimiter) { this.delimiter = Objects.requireNonNull(delimiter, "delimiter"); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getPath() path} attribute. * @param path The value for path (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("path") public final FileVariable.Builder path(String path) { this.path = path; return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getChangePolicy() changePolicy} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getChangePolicy() changePolicy}. * @param changePolicy The value for changePolicy * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("change_policy") public final FileVariable.Builder changePolicy(Variable.ChangePolicy changePolicy) { this.changePolicy = Objects.requireNonNull(changePolicy, "changePolicy"); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getScope() scope} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getScope() scope}. * @param scope The value for scope * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("scope") public final FileVariable.Builder scope(Variable.Scope scope) { this.scope = Objects.requireNonNull(scope, "scope"); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getOrder() order} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getOrder() order}. * @param order The value for order * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("order") public final FileVariable.Builder order(Variable.Order order) { this.order = Objects.requireNonNull(order, "order"); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getOutOfValue() outOfValue} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link FileVariable#getOutOfValue() outOfValue}. * @param outOfValue The value for outOfValue * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("out_of_value") public final FileVariable.Builder outOfValue(Variable.OutOfValue outOfValue) { this.outOfValue = Objects.requireNonNull(outOfValue, "outOfValue"); return (FileVariable.Builder) this; } /** * Initializes the value for the {@link FileVariable#getName() name} attribute. * @param name The value for name (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("name") public final FileVariable.Builder name(String name) { this.name = name; return (FileVariable.Builder) this; } /** * Initializes the optional value {@link FileVariable#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final FileVariable.Builder description(String description) { this.description = Objects.requireNonNull(description, "description"); return (FileVariable.Builder) this; } /** * Initializes the optional value {@link FileVariable#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("description") public final FileVariable.Builder description(Optional description) { this.description = description.orElse(null); return (FileVariable.Builder) this; } /** * Builds a new {@link ImmutableFileVariable ImmutableFileVariable}. * @return An immutable instance of FileVariable * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableFileVariable build() { return new ImmutableFileVariable(this); } private boolean isFirstLineColumnNamesIsSet() { return (optBits & OPT_BIT_IS_FIRST_LINE_COLUMN_NAMES) != 0; } private boolean startFromLineIsSet() { return (optBits & OPT_BIT_START_FROM_LINE) != 0; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy