com.neotys.neoload.model.v3.project.variable.ImmutableCounterVariable 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.Lists;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.project.Element;
import java.util.ArrayList;
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;
/**
* Immutable implementation of {@link CounterVariable}.
*
* Use the builder to create immutable instances:
* {@code new CounterVariable.Builder()}.
*/
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "CounterVariable"})
@Immutable
@CheckReturnValue
public final class ImmutableCounterVariable
implements CounterVariable {
private final int start;
private final int end;
private final int increment;
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 ImmutableCounterVariable(ImmutableCounterVariable.Builder builder) {
this.start = builder.start;
this.end = builder.end;
this.increment = builder.increment;
this.name = builder.name;
this.description = builder.description;
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.changePolicy = initShim.getChangePolicy();
this.scope = initShim.getScope();
this.order = initShim.getOrder();
this.outOfValue = initShim.getOutOfValue();
this.initShim = null;
}
private ImmutableCounterVariable(
int start,
int end,
int increment,
Variable.ChangePolicy changePolicy,
Variable.Scope scope,
Variable.Order order,
Variable.OutOfValue outOfValue,
String name,
@Nullable String description) {
this.start = start;
this.end = end;
this.increment = increment;
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 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 (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 CounterVariable, attribute initializers form cycle" + attributes;
}
}
private Variable.ChangePolicy getChangePolicyInitialize() {
return CounterVariable.super.getChangePolicy();
}
private Variable.Scope getScopeInitialize() {
return CounterVariable.super.getScope();
}
private Variable.Order getOrderInitialize() {
return CounterVariable.super.getOrder();
}
private Variable.OutOfValue getOutOfValueInitialize() {
return CounterVariable.super.getOutOfValue();
}
/**
* @return The value of the {@code start} attribute
*/
@JsonProperty("start")
@Override
public int getStart() {
return start;
}
/**
* @return The value of the {@code end} attribute
*/
@JsonProperty("end")
@Override
public int getEnd() {
return end;
}
/**
* @return The value of the {@code increment} attribute
*/
@JsonProperty("increment")
@Override
public int getIncrement() {
return increment;
}
/**
* @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 by setting a value for the {@link CounterVariable#getStart() start} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for start
* @return A modified copy of the {@code this} object
*/
public final ImmutableCounterVariable withStart(int value) {
if (this.start == value) return this;
return new ImmutableCounterVariable(
value,
this.end,
this.increment,
this.changePolicy,
this.scope,
this.order,
this.outOfValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#getEnd() end} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for end
* @return A modified copy of the {@code this} object
*/
public final ImmutableCounterVariable withEnd(int value) {
if (this.end == value) return this;
return new ImmutableCounterVariable(
this.start,
value,
this.increment,
this.changePolicy,
this.scope,
this.order,
this.outOfValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#getIncrement() increment} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for increment
* @return A modified copy of the {@code this} object
*/
public final ImmutableCounterVariable withIncrement(int value) {
if (this.increment == value) return this;
return new ImmutableCounterVariable(
this.start,
this.end,
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 CounterVariable#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 ImmutableCounterVariable withChangePolicy(Variable.ChangePolicy value) {
if (this.changePolicy == value) return this;
Variable.ChangePolicy newValue = Objects.requireNonNull(value, "changePolicy");
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
newValue,
this.scope,
this.order,
this.outOfValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#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 ImmutableCounterVariable withScope(Variable.Scope value) {
if (this.scope == value) return this;
Variable.Scope newValue = Objects.requireNonNull(value, "scope");
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
this.changePolicy,
newValue,
this.order,
this.outOfValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#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 ImmutableCounterVariable withOrder(Variable.Order value) {
if (this.order == value) return this;
Variable.Order newValue = Objects.requireNonNull(value, "order");
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
this.changePolicy,
this.scope,
newValue,
this.outOfValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#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 ImmutableCounterVariable withOutOfValue(Variable.OutOfValue value) {
if (this.outOfValue == value) return this;
Variable.OutOfValue newValue = Objects.requireNonNull(value, "outOfValue");
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
this.changePolicy,
this.scope,
this.order,
newValue,
this.name,
this.description);
}
/**
* Copy the current immutable object by setting a value for the {@link CounterVariable#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 ImmutableCounterVariable withName(String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
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 CounterVariable#getDescription() description} attribute.
* @param value The value for description
* @return A modified copy of {@code this} object
*/
public final ImmutableCounterVariable withDescription(String value) {
@Nullable String newValue = Objects.requireNonNull(value, "description");
if (Objects.equals(this.description, newValue)) return this;
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
this.changePolicy,
this.scope,
this.order,
this.outOfValue,
this.name,
newValue);
}
/**
* Copy the current immutable object by setting an optional value for the {@link CounterVariable#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 ImmutableCounterVariable withDescription(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.description, value)) return this;
return new ImmutableCounterVariable(
this.start,
this.end,
this.increment,
this.changePolicy,
this.scope,
this.order,
this.outOfValue,
this.name,
value);
}
/**
* This instance is equal to all instances of {@code ImmutableCounterVariable} 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 ImmutableCounterVariable
&& equalTo((ImmutableCounterVariable) another);
}
private boolean equalTo(ImmutableCounterVariable another) {
return start == another.start
&& end == another.end
&& increment == another.increment
&& 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 start}, {@code end}, {@code increment}, {@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) + start;
h += (h << 5) + end;
h += (h << 5) + increment;
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 CounterVariable} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("CounterVariable")
.omitNullValues()
.add("start", start)
.add("end", end)
.add("increment", increment)
.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 CounterVariable {
int start;
boolean startIsSet;
int end;
boolean endIsSet;
int increment;
boolean incrementIsSet;
@Nullable Variable.ChangePolicy changePolicy;
@Nullable Variable.Scope scope;
@Nullable Variable.Order order;
@Nullable Variable.OutOfValue outOfValue;
@Nullable String name;
Optional description = Optional.empty();
@JsonProperty("start")
public void setStart(int start) {
this.start = start;
this.startIsSet = true;
}
@JsonProperty("end")
public void setEnd(int end) {
this.end = end;
this.endIsSet = true;
}
@JsonProperty("increment")
public void setIncrement(int increment) {
this.increment = increment;
this.incrementIsSet = true;
}
@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 int getStart() { throw new UnsupportedOperationException(); }
@Override
public int getEnd() { throw new UnsupportedOperationException(); }
@Override
public int getIncrement() { 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 ImmutableCounterVariable fromJson(Json json) {
CounterVariable.Builder builder = new CounterVariable.Builder();
if (json.startIsSet) {
builder.start(json.start);
}
if (json.endIsSet) {
builder.end(json.end);
}
if (json.incrementIsSet) {
builder.increment(json.increment);
}
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 (ImmutableCounterVariable) builder.build();
}
/**
* Creates an immutable copy of a {@link CounterVariable} 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 CounterVariable instance
*/
public static ImmutableCounterVariable copyOf(CounterVariable instance) {
if (instance instanceof ImmutableCounterVariable) {
return (ImmutableCounterVariable) instance;
}
return new CounterVariable.Builder()
.from(instance)
.build();
}
/**
* Builds instances of type {@link ImmutableCounterVariable ImmutableCounterVariable}.
* 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 int start;
private int end;
private int increment;
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 ImmutableCounterVariable ImmutableCounterVariable} instances.
*/
public Builder() {
if (!(this instanceof CounterVariable.Builder)) {
throw new UnsupportedOperationException("Use: new CounterVariable.Builder()");
}
}
/**
* 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 CounterVariable.Builder from(Element instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (CounterVariable.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 CounterVariable.Builder from(Variable instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (CounterVariable.Builder) this;
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.variable.CounterVariable} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final CounterVariable.Builder from(CounterVariable instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (CounterVariable.Builder) this;
}
private void from(Object object) {
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());
}
if (object instanceof CounterVariable) {
CounterVariable instance = (CounterVariable) object;
start(instance.getStart());
increment(instance.getIncrement());
end(instance.getEnd());
}
}
/**
* Initializes the value for the {@link CounterVariable#getStart() start} attribute.
* @param start The value for start
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("start")
public final CounterVariable.Builder start(int start) {
this.start = start;
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getEnd() end} attribute.
* @param end The value for end
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("end")
public final CounterVariable.Builder end(int end) {
this.end = end;
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getIncrement() increment} attribute.
* @param increment The value for increment
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("increment")
public final CounterVariable.Builder increment(int increment) {
this.increment = increment;
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getChangePolicy() changePolicy} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link CounterVariable#getChangePolicy() changePolicy}.
* @param changePolicy The value for changePolicy
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("change_policy")
public final CounterVariable.Builder changePolicy(Variable.ChangePolicy changePolicy) {
this.changePolicy = Objects.requireNonNull(changePolicy, "changePolicy");
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getScope() scope} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link CounterVariable#getScope() scope}.
* @param scope The value for scope
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("scope")
public final CounterVariable.Builder scope(Variable.Scope scope) {
this.scope = Objects.requireNonNull(scope, "scope");
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getOrder() order} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link CounterVariable#getOrder() order}.
* @param order The value for order
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("order")
public final CounterVariable.Builder order(Variable.Order order) {
this.order = Objects.requireNonNull(order, "order");
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#getOutOfValue() outOfValue} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link CounterVariable#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 CounterVariable.Builder outOfValue(Variable.OutOfValue outOfValue) {
this.outOfValue = Objects.requireNonNull(outOfValue, "outOfValue");
return (CounterVariable.Builder) this;
}
/**
* Initializes the value for the {@link CounterVariable#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 CounterVariable.Builder name(String name) {
this.name = name;
return (CounterVariable.Builder) this;
}
/**
* Initializes the optional value {@link CounterVariable#getDescription() description} to description.
* @param description The value for description
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final CounterVariable.Builder description(String description) {
this.description = Objects.requireNonNull(description, "description");
return (CounterVariable.Builder) this;
}
/**
* Initializes the optional value {@link CounterVariable#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 CounterVariable.Builder description(Optional description) {
this.description = description.orElse(null);
return (CounterVariable.Builder) this;
}
/**
* Builds a new {@link ImmutableCounterVariable ImmutableCounterVariable}.
* @return An immutable instance of CounterVariable
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCounterVariable build() {
return new ImmutableCounterVariable(this);
}
}
}