com.neotys.neoload.model.v3.project.variable.ImmutableJavaScriptVariable 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.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import com.neotys.neoload.model.v3.project.Element;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link JavaScriptVariable}.
*
* Use the builder to create immutable instances:
* {@code new JavaScriptVariable.Builder()}.
*/
@Generated(from = "JavaScriptVariable", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableJavaScriptVariable
implements JavaScriptVariable {
private final String name;
private final @Nullable String description;
private final Variable.ChangePolicy changePolicy;
private final Variable.Scope scope;
private final Variable.Order order;
private final Variable.OutOfValue outOfValue;
private final String script;
private ImmutableJavaScriptVariable(ImmutableJavaScriptVariable.Builder builder) {
this.name = builder.name;
this.description = builder.description;
this.script = builder.script;
if (builder.changePolicyIsSet()) {
initShim.changePolicy(builder.changePolicy);
}
if (builder.scopeIsSet()) {
initShim.scope(builder.scope);
}
if (builder.orderIsSet()) {
initShim.order(builder.order);
}
if (builder.outOfValueIsSet()) {
initShim.outOfValue(builder.outOfValue);
}
this.changePolicy = initShim.getChangePolicy();
this.scope = initShim.getScope();
this.order = initShim.getOrder();
this.outOfValue = initShim.getOutOfValue();
this.initShim = null;
}
private ImmutableJavaScriptVariable(
String name,
@Nullable String description,
Variable.ChangePolicy changePolicy,
Variable.Scope scope,
Variable.Order order,
Variable.OutOfValue outOfValue,
String script) {
this.name = name;
this.description = description;
this.changePolicy = changePolicy;
this.scope = scope;
this.order = order;
this.outOfValue = outOfValue;
this.script = script;
this.initShim = null;
}
private static final byte STAGE_INITIALIZING = -1;
private static final byte STAGE_UNINITIALIZED = 0;
private static final byte STAGE_INITIALIZED = 1;
@SuppressWarnings("Immutable")
private transient volatile InitShim initShim = new InitShim();
@Generated(from = "JavaScriptVariable", generator = "Immutables")
private final class InitShim {
private byte changePolicyBuildStage = STAGE_UNINITIALIZED;
private Variable.ChangePolicy changePolicy;
Variable.ChangePolicy getChangePolicy() {
if (changePolicyBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (changePolicyBuildStage == STAGE_UNINITIALIZED) {
changePolicyBuildStage = STAGE_INITIALIZING;
this.changePolicy = getChangePolicyInitialize();
changePolicyBuildStage = STAGE_INITIALIZED;
}
return this.changePolicy;
}
void changePolicy(Variable.ChangePolicy changePolicy) {
this.changePolicy = changePolicy;
changePolicyBuildStage = STAGE_INITIALIZED;
}
private byte scopeBuildStage = STAGE_UNINITIALIZED;
private Variable.Scope scope;
Variable.Scope getScope() {
if (scopeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (scopeBuildStage == STAGE_UNINITIALIZED) {
scopeBuildStage = STAGE_INITIALIZING;
this.scope = getScopeInitialize();
scopeBuildStage = STAGE_INITIALIZED;
}
return this.scope;
}
void scope(Variable.Scope scope) {
this.scope = scope;
scopeBuildStage = STAGE_INITIALIZED;
}
private byte orderBuildStage = STAGE_UNINITIALIZED;
private Variable.Order order;
Variable.Order getOrder() {
if (orderBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (orderBuildStage == STAGE_UNINITIALIZED) {
orderBuildStage = STAGE_INITIALIZING;
this.order = getOrderInitialize();
orderBuildStage = STAGE_INITIALIZED;
}
return this.order;
}
void order(Variable.Order order) {
this.order = order;
orderBuildStage = STAGE_INITIALIZED;
}
private byte outOfValueBuildStage = STAGE_UNINITIALIZED;
private Variable.OutOfValue outOfValue;
Variable.OutOfValue getOutOfValue() {
if (outOfValueBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (outOfValueBuildStage == STAGE_UNINITIALIZED) {
outOfValueBuildStage = STAGE_INITIALIZING;
this.outOfValue = getOutOfValueInitialize();
outOfValueBuildStage = STAGE_INITIALIZED;
}
return this.outOfValue;
}
void outOfValue(Variable.OutOfValue outOfValue) {
this.outOfValue = outOfValue;
outOfValueBuildStage = STAGE_INITIALIZED;
}
private String formatInitCycleMessage() {
List attributes = new ArrayList<>();
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 JavaScriptVariable, attribute initializers form cycle " + attributes;
}
}
private Variable.ChangePolicy getChangePolicyInitialize() {
return JavaScriptVariable.super.getChangePolicy();
}
private Variable.Scope getScopeInitialize() {
return JavaScriptVariable.super.getScope();
}
private Variable.Order getOrderInitialize() {
return JavaScriptVariable.super.getOrder();
}
private Variable.OutOfValue getOutOfValueInitialize() {
return JavaScriptVariable.super.getOutOfValue();
}
/**
* @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);
}
/**
* @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 script} attribute
*/
@JsonProperty("script")
@Override
public String getScript() {
return script;
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withName(String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableJavaScriptVariable(
value,
this.description,
this.changePolicy,
this.scope,
this.order,
this.outOfValue,
this.script);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link JavaScriptVariable#getDescription() description} attribute.
* @param value The value for description
* @return A modified copy of {@code this} object
*/
public final ImmutableJavaScriptVariable withDescription(String value) {
String newValue = Objects.requireNonNull(value, "description");
if (Objects.equals(this.description, newValue)) return this;
return new ImmutableJavaScriptVariable(this.name, newValue, this.changePolicy, this.scope, this.order, this.outOfValue, this.script);
}
/**
* Copy the current immutable object by setting an optional value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withDescription(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.description, value)) return this;
return new ImmutableJavaScriptVariable(this.name, value, this.changePolicy, this.scope, this.order, this.outOfValue, this.script);
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withChangePolicy(Variable.ChangePolicy value) {
Variable.ChangePolicy newValue = value;
if (this.changePolicy == newValue) return this;
return new ImmutableJavaScriptVariable(this.name, this.description, newValue, this.scope, this.order, this.outOfValue, this.script);
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withScope(Variable.Scope value) {
Variable.Scope newValue = value;
if (this.scope == newValue) return this;
return new ImmutableJavaScriptVariable(
this.name,
this.description,
this.changePolicy,
newValue,
this.order,
this.outOfValue,
this.script);
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withOrder(Variable.Order value) {
Variable.Order newValue = value;
if (this.order == newValue) return this;
return new ImmutableJavaScriptVariable(
this.name,
this.description,
this.changePolicy,
this.scope,
newValue,
this.outOfValue,
this.script);
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#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 ImmutableJavaScriptVariable withOutOfValue(Variable.OutOfValue value) {
Variable.OutOfValue newValue = value;
if (this.outOfValue == newValue) return this;
return new ImmutableJavaScriptVariable(this.name, this.description, this.changePolicy, this.scope, this.order, newValue, this.script);
}
/**
* Copy the current immutable object by setting a value for the {@link JavaScriptVariable#getScript() script} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for script (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableJavaScriptVariable withScript(String value) {
if (Objects.equals(this.script, value)) return this;
return new ImmutableJavaScriptVariable(this.name, this.description, this.changePolicy, this.scope, this.order, this.outOfValue, value);
}
/**
* This instance is equal to all instances of {@code ImmutableJavaScriptVariable} 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 ImmutableJavaScriptVariable
&& equalTo(0, (ImmutableJavaScriptVariable) another);
}
private boolean equalTo(int synthetic, ImmutableJavaScriptVariable another) {
return Objects.equals(name, another.name)
&& Objects.equals(description, another.description)
&& changePolicy.equals(another.changePolicy)
&& scope.equals(another.scope)
&& order.equals(another.order)
&& outOfValue.equals(another.outOfValue)
&& Objects.equals(script, another.script);
}
/**
* Computes a hash code from attributes: {@code name}, {@code description}, {@code changePolicy}, {@code scope}, {@code order}, {@code outOfValue}, {@code script}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(description);
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(script);
return h;
}
/**
* Prints the immutable value {@code JavaScriptVariable} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("JavaScriptVariable")
.omitNullValues()
.add("name", name)
.add("description", description)
.add("changePolicy", changePolicy)
.add("scope", scope)
.add("order", order)
.add("outOfValue", outOfValue)
.add("script", script)
.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
*/
@Generated(from = "JavaScriptVariable", generator = "Immutables")
@Deprecated
@SuppressWarnings("Immutable")
@JsonDeserialize
@JsonTypeInfo(use=JsonTypeInfo.Id.NONE)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json implements JavaScriptVariable {
@Nullable String name;
@Nullable Optional description = Optional.empty();
@Nullable Variable.ChangePolicy changePolicy;
boolean changePolicyIsSet;
@Nullable Variable.Scope scope;
boolean scopeIsSet;
@Nullable Variable.Order order;
boolean orderIsSet;
@Nullable Variable.OutOfValue outOfValue;
boolean outOfValueIsSet;
@Nullable String script;
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("description")
public void setDescription(Optional description) {
this.description = description;
}
@JsonProperty("change_policy")
public void setChangePolicy(Variable.ChangePolicy changePolicy) {
this.changePolicy = changePolicy;
this.changePolicyIsSet = null != changePolicy;
}
@JsonProperty("scope")
public void setScope(Variable.Scope scope) {
this.scope = scope;
this.scopeIsSet = null != scope;
}
@JsonProperty("order")
public void setOrder(Variable.Order order) {
this.order = order;
this.orderIsSet = null != order;
}
@JsonProperty("out_of_value")
public void setOutOfValue(Variable.OutOfValue outOfValue) {
this.outOfValue = outOfValue;
this.outOfValueIsSet = null != outOfValue;
}
@JsonProperty("script")
public void setScript(String script) {
this.script = script;
}
@Override
public Element withName(String of) { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public Optional getDescription() { 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 getScript() { 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 ImmutableJavaScriptVariable fromJson(Json json) {
JavaScriptVariable.Builder builder = new JavaScriptVariable.Builder();
if (json.name != null) {
builder.name(json.name);
}
if (json.description != null) {
builder.description(json.description);
}
if (json.changePolicyIsSet) {
builder.changePolicy(json.changePolicy);
}
if (json.scopeIsSet) {
builder.scope(json.scope);
}
if (json.orderIsSet) {
builder.order(json.order);
}
if (json.outOfValueIsSet) {
builder.outOfValue(json.outOfValue);
}
if (json.script != null) {
builder.script(json.script);
}
return (ImmutableJavaScriptVariable) builder.build();
}
/**
* Creates an immutable copy of a {@link JavaScriptVariable} 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 JavaScriptVariable instance
*/
public static ImmutableJavaScriptVariable copyOf(JavaScriptVariable instance) {
if (instance instanceof ImmutableJavaScriptVariable) {
return (ImmutableJavaScriptVariable) instance;
}
return new JavaScriptVariable.Builder()
.from(instance)
.build();
}
/**
* Builds instances of type {@link ImmutableJavaScriptVariable ImmutableJavaScriptVariable}.
* 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.
*/
@Generated(from = "JavaScriptVariable", generator = "Immutables")
@NotThreadSafe
public static class Builder {
private static final long OPT_BIT_CHANGE_POLICY = 0x1L;
private static final long OPT_BIT_SCOPE = 0x2L;
private static final long OPT_BIT_ORDER = 0x4L;
private static final long OPT_BIT_OUT_OF_VALUE = 0x8L;
private long optBits;
private @Nullable String name;
private @Nullable String description;
private @Nullable Variable.ChangePolicy changePolicy;
private @Nullable Variable.Scope scope;
private @Nullable Variable.Order order;
private @Nullable Variable.OutOfValue outOfValue;
private @Nullable String script;
/**
* Creates a builder for {@link ImmutableJavaScriptVariable ImmutableJavaScriptVariable} instances.
*
* new JavaScriptVariable.Builder()
* .name(String | null) // nullable {@link JavaScriptVariable#getName() name}
* .description(String) // optional {@link JavaScriptVariable#getDescription() description}
* .changePolicy(com.neotys.neoload.model.v3.project.variable.Variable.ChangePolicy) // optional {@link JavaScriptVariable#getChangePolicy() changePolicy}
* .scope(com.neotys.neoload.model.v3.project.variable.Variable.Scope) // optional {@link JavaScriptVariable#getScope() scope}
* .order(com.neotys.neoload.model.v3.project.variable.Variable.Order) // optional {@link JavaScriptVariable#getOrder() order}
* .outOfValue(com.neotys.neoload.model.v3.project.variable.Variable.OutOfValue) // optional {@link JavaScriptVariable#getOutOfValue() outOfValue}
* .script(String | null) // nullable {@link JavaScriptVariable#getScript() script}
* .build();
*
*/
public Builder() {
if (!(this instanceof JavaScriptVariable.Builder)) {
throw new UnsupportedOperationException("Use: new JavaScriptVariable.Builder()");
}
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.variable.JavaScriptVariable} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final JavaScriptVariable.Builder from(JavaScriptVariable instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (JavaScriptVariable.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 JavaScriptVariable.Builder from(Element instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (JavaScriptVariable.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 JavaScriptVariable.Builder from(Variable instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return (JavaScriptVariable.Builder) this;
}
private void from(Object object) {
@Var long bits = 0;
if (object instanceof JavaScriptVariable) {
JavaScriptVariable instance = (JavaScriptVariable) object;
if ((bits & 0x1L) == 0) {
scope(instance.getScope());
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
outOfValue(instance.getOutOfValue());
bits |= 0x2L;
}
if ((bits & 0x4L) == 0) {
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x8L;
}
if ((bits & 0x10L) == 0) {
changePolicy(instance.getChangePolicy());
bits |= 0x10L;
}
String scriptValue = instance.getScript();
if (scriptValue != null) {
script(scriptValue);
}
if ((bits & 0x20L) == 0) {
order(instance.getOrder());
bits |= 0x20L;
}
}
if (object instanceof Element) {
Element instance = (Element) object;
if ((bits & 0x4L) == 0) {
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x8L;
}
}
if (object instanceof Variable) {
Variable instance = (Variable) object;
if ((bits & 0x4L) == 0) {
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x8L;
}
if ((bits & 0x10L) == 0) {
changePolicy(instance.getChangePolicy());
bits |= 0x10L;
}
if ((bits & 0x1L) == 0) {
scope(instance.getScope());
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
outOfValue(instance.getOutOfValue());
bits |= 0x2L;
}
if ((bits & 0x20L) == 0) {
order(instance.getOrder());
bits |= 0x20L;
}
}
}
/**
* Initializes the value for the {@link JavaScriptVariable#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 JavaScriptVariable.Builder name(String name) {
this.name = name;
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the optional value {@link JavaScriptVariable#getDescription() description} to description.
* @param description The value for description
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final JavaScriptVariable.Builder description(String description) {
this.description = Objects.requireNonNull(description, "description");
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the optional value {@link JavaScriptVariable#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 JavaScriptVariable.Builder description(Optional description) {
this.description = description.orElse(null);
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the value for the {@link JavaScriptVariable#getChangePolicy() changePolicy} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link JavaScriptVariable#getChangePolicy() changePolicy}.
* @param changePolicy The value for changePolicy
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("change_policy")
public final JavaScriptVariable.Builder changePolicy(Variable.ChangePolicy changePolicy) {
this.changePolicy = changePolicy;
optBits |= OPT_BIT_CHANGE_POLICY;
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the value for the {@link JavaScriptVariable#getScope() scope} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link JavaScriptVariable#getScope() scope}.
* @param scope The value for scope
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("scope")
public final JavaScriptVariable.Builder scope(Variable.Scope scope) {
this.scope = scope;
optBits |= OPT_BIT_SCOPE;
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the value for the {@link JavaScriptVariable#getOrder() order} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link JavaScriptVariable#getOrder() order}.
* @param order The value for order
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("order")
public final JavaScriptVariable.Builder order(Variable.Order order) {
this.order = order;
optBits |= OPT_BIT_ORDER;
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the value for the {@link JavaScriptVariable#getOutOfValue() outOfValue} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link JavaScriptVariable#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 JavaScriptVariable.Builder outOfValue(Variable.OutOfValue outOfValue) {
this.outOfValue = outOfValue;
optBits |= OPT_BIT_OUT_OF_VALUE;
return (JavaScriptVariable.Builder) this;
}
/**
* Initializes the value for the {@link JavaScriptVariable#getScript() script} attribute.
* @param script The value for script (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("script")
public final JavaScriptVariable.Builder script(String script) {
this.script = script;
return (JavaScriptVariable.Builder) this;
}
/**
* Builds a new {@link ImmutableJavaScriptVariable ImmutableJavaScriptVariable}.
* @return An immutable instance of JavaScriptVariable
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableJavaScriptVariable build() {
return new ImmutableJavaScriptVariable(this);
}
private boolean changePolicyIsSet() {
return (optBits & OPT_BIT_CHANGE_POLICY) != 0;
}
private boolean scopeIsSet() {
return (optBits & OPT_BIT_SCOPE) != 0;
}
private boolean orderIsSet() {
return (optBits & OPT_BIT_ORDER) != 0;
}
private boolean outOfValueIsSet() {
return (optBits & OPT_BIT_OUT_OF_VALUE) != 0;
}
}
}