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

com.neotys.neoload.model.v3.project.userpath.ImmutableUserPath Maven / Gradle / Ivy

There is a newer version: 3.3.3
Show newest version
package com.neotys.neoload.model.v3.project.userpath;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import com.neotys.neoload.model.v3.binding.serializer.AssertionsDeserializer;
import com.neotys.neoload.model.v3.binding.serializer.AssertionsSerializer;
import com.neotys.neoload.model.v3.project.Element;
import com.neotys.neoload.model.v3.project.userpath.assertion.Assertion;
import com.neotys.neoload.model.v3.project.userpath.assertion.AssertionsElement;
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 UserPath}.
 * 

* Use the builder to create immutable instances: * {@code new UserPath.Builder()}. */ @Generated(from = "UserPath", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableUserPath implements UserPath { private final String name; private final @Nullable String description; private final ImmutableList assertions; private final UserPath.UserSession userSession; private final @Nullable Container init; private final Container actions; private final @Nullable Container end; private ImmutableUserPath(ImmutableUserPath.Builder builder) { this.name = builder.name; this.description = builder.description; this.assertions = builder.assertions.build(); this.init = builder.init; this.actions = builder.actions; this.end = builder.end; this.userSession = builder.userSessionIsSet() ? builder.userSession : UserPath.super.getUserSession(); } private ImmutableUserPath( String name, @Nullable String description, ImmutableList assertions, UserPath.UserSession userSession, @Nullable Container init, Container actions, @Nullable Container end) { this.name = name; this.description = description; this.assertions = assertions; this.userSession = userSession; this.init = init; this.actions = actions; this.end = end; } /** * @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 assertions} attribute */ @JsonProperty("assertions") @JsonDeserialize(using = AssertionsDeserializer.class) @JsonSerialize(using = AssertionsSerializer.class) @Override public ImmutableList getAssertions() { return assertions; } /** * @return The value of the {@code userSession} attribute */ @JsonProperty("userSession") @JsonInclude(JsonInclude.Include.NON_DEFAULT) @Override public UserPath.UserSession getUserSession() { return userSession; } /** * @return The value of the {@code init} attribute */ @JsonProperty("init") @Override public Optional getInit() { return Optional.ofNullable(init); } /** * @return The value of the {@code actions} attribute */ @JsonProperty("actions") @Override public Container getActions() { return actions; } /** * @return The value of the {@code end} attribute */ @JsonProperty("end") @Override public Optional getEnd() { return Optional.ofNullable(end); } /** * Copy the current immutable object by setting a value for the {@link UserPath#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 ImmutableUserPath withName(String value) { if (Objects.equals(this.name, value)) return this; return new ImmutableUserPath(value, this.description, this.assertions, this.userSession, this.init, this.actions, this.end); } /** * Copy the current immutable object by setting a present value for the optional {@link UserPath#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableUserPath withDescription(String value) { String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableUserPath(this.name, newValue, this.assertions, this.userSession, this.init, this.actions, this.end); } /** * Copy the current immutable object by setting an optional value for the {@link UserPath#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 ImmutableUserPath withDescription(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableUserPath(this.name, value, this.assertions, this.userSession, this.init, this.actions, this.end); } /** * Copy the current immutable object with elements that replace the content of {@link UserPath#getAssertions() assertions}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableUserPath withAssertions(Assertion... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableUserPath(this.name, this.description, newValue, this.userSession, this.init, this.actions, this.end); } /** * Copy the current immutable object with elements that replace the content of {@link UserPath#getAssertions() assertions}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of assertions elements to set * @return A modified copy of {@code this} object */ public final ImmutableUserPath withAssertions(Iterable elements) { if (this.assertions == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableUserPath(this.name, this.description, newValue, this.userSession, this.init, this.actions, this.end); } /** * Copy the current immutable object by setting a value for the {@link UserPath#getUserSession() userSession} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for userSession * @return A modified copy of the {@code this} object */ public final ImmutableUserPath withUserSession(UserPath.UserSession value) { UserPath.UserSession newValue = value; if (this.userSession == newValue) return this; return new ImmutableUserPath(this.name, this.description, this.assertions, newValue, this.init, this.actions, this.end); } /** * Copy the current immutable object by setting a present value for the optional {@link UserPath#getInit() init} attribute. * @param value The value for init * @return A modified copy of {@code this} object */ public final ImmutableUserPath withInit(Container value) { Container newValue = Objects.requireNonNull(value, "init"); if (this.init == newValue) return this; return new ImmutableUserPath( this.name, this.description, this.assertions, this.userSession, newValue, this.actions, this.end); } /** * Copy the current immutable object by setting an optional value for the {@link UserPath#getInit() init} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for init * @return A modified copy of {@code this} object */ @SuppressWarnings("unchecked") // safe covariant cast public final ImmutableUserPath withInit(Optional optional) { @Nullable Container value = optional.orElse(null); if (this.init == value) return this; return new ImmutableUserPath(this.name, this.description, this.assertions, this.userSession, value, this.actions, this.end); } /** * Copy the current immutable object by setting a value for the {@link UserPath#getActions() actions} 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 actions (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableUserPath withActions(Container value) { if (this.actions == value) return this; return new ImmutableUserPath(this.name, this.description, this.assertions, this.userSession, this.init, value, this.end); } /** * Copy the current immutable object by setting a present value for the optional {@link UserPath#getEnd() end} attribute. * @param value The value for end * @return A modified copy of {@code this} object */ public final ImmutableUserPath withEnd(Container value) { Container newValue = Objects.requireNonNull(value, "end"); if (this.end == newValue) return this; return new ImmutableUserPath( this.name, this.description, this.assertions, this.userSession, this.init, this.actions, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link UserPath#getEnd() end} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for end * @return A modified copy of {@code this} object */ @SuppressWarnings("unchecked") // safe covariant cast public final ImmutableUserPath withEnd(Optional optional) { @Nullable Container value = optional.orElse(null); if (this.end == value) return this; return new ImmutableUserPath(this.name, this.description, this.assertions, this.userSession, this.init, this.actions, value); } /** * This instance is equal to all instances of {@code ImmutableUserPath} 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 ImmutableUserPath && equalTo(0, (ImmutableUserPath) another); } private boolean equalTo(int synthetic, ImmutableUserPath another) { return Objects.equals(name, another.name) && Objects.equals(description, another.description) && assertions.equals(another.assertions) && userSession.equals(another.userSession) && Objects.equals(init, another.init) && Objects.equals(actions, another.actions) && Objects.equals(end, another.end); } /** * Computes a hash code from attributes: {@code name}, {@code description}, {@code assertions}, {@code userSession}, {@code init}, {@code actions}, {@code end}. * @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) + assertions.hashCode(); h += (h << 5) + userSession.hashCode(); h += (h << 5) + Objects.hashCode(init); h += (h << 5) + Objects.hashCode(actions); h += (h << 5) + Objects.hashCode(end); return h; } /** * Prints the immutable value {@code UserPath} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("UserPath") .omitNullValues() .add("name", name) .add("description", description) .add("assertions", assertions) .add("userSession", userSession) .add("init", init) .add("actions", actions) .add("end", end) .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 = "UserPath", generator = "Immutables") @Deprecated @SuppressWarnings("Immutable") @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements UserPath { @Nullable String name; @Nullable Optional description = Optional.empty(); @Nullable List assertions = ImmutableList.of(); @Nullable UserPath.UserSession userSession; boolean userSessionIsSet; @Nullable Optional init = Optional.empty(); @Nullable Container actions; @Nullable Optional end = Optional.empty(); @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("description") public void setDescription(Optional description) { this.description = description; } @JsonProperty("assertions") @JsonDeserialize(using = AssertionsDeserializer.class) @JsonSerialize(using = AssertionsSerializer.class) public void setAssertions(List assertions) { this.assertions = assertions; } @JsonProperty("userSession") @JsonInclude(JsonInclude.Include.NON_DEFAULT) public void setUserSession(UserPath.UserSession userSession) { this.userSession = userSession; this.userSessionIsSet = null != userSession; } @JsonProperty("init") public void setInit(Optional init) { this.init = init; } @JsonProperty("actions") public void setActions(Container actions) { this.actions = actions; } @JsonProperty("end") public void setEnd(Optional end) { this.end = end; } @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 List getAssertions() { throw new UnsupportedOperationException(); } @Override public UserPath.UserSession getUserSession() { throw new UnsupportedOperationException(); } @Override public Optional getInit() { throw new UnsupportedOperationException(); } @Override public Container getActions() { throw new UnsupportedOperationException(); } @Override public Optional getEnd() { 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 ImmutableUserPath fromJson(Json json) { UserPath.Builder builder = new UserPath.Builder(); if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } if (json.assertions != null) { builder.addAllAssertions(json.assertions); } if (json.userSessionIsSet) { builder.userSession(json.userSession); } if (json.init != null) { builder.init(json.init); } if (json.actions != null) { builder.actions(json.actions); } if (json.end != null) { builder.end(json.end); } return (ImmutableUserPath) builder.build(); } /** * Creates an immutable copy of a {@link UserPath} 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 UserPath instance */ public static ImmutableUserPath copyOf(UserPath instance) { if (instance instanceof ImmutableUserPath) { return (ImmutableUserPath) instance; } return new UserPath.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableUserPath ImmutableUserPath}. * 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 = "UserPath", generator = "Immutables") @NotThreadSafe public static class Builder { private static final long OPT_BIT_USER_SESSION = 0x1L; private long optBits; private @Nullable String name; private @Nullable String description; private ImmutableList.Builder assertions = ImmutableList.builder(); private @Nullable UserPath.UserSession userSession; private @Nullable Container init; private @Nullable Container actions; private @Nullable Container end; /** * Creates a builder for {@link ImmutableUserPath ImmutableUserPath} instances. *

     * new UserPath.Builder()
     *    .name(String | null) // nullable {@link UserPath#getName() name}
     *    .description(String) // optional {@link UserPath#getDescription() description}
     *    .addAssertions|addAllAssertions(com.neotys.neoload.model.v3.project.userpath.assertion.Assertion) // {@link UserPath#getAssertions() assertions} elements
     *    .userSession(com.neotys.neoload.model.v3.project.userpath.UserPath.UserSession) // optional {@link UserPath#getUserSession() userSession}
     *    .init(com.neotys.neoload.model.v3.project.userpath.Container) // optional {@link UserPath#getInit() init}
     *    .actions(com.neotys.neoload.model.v3.project.userpath.Container | null) // nullable {@link UserPath#getActions() actions}
     *    .end(com.neotys.neoload.model.v3.project.userpath.Container) // optional {@link UserPath#getEnd() end}
     *    .build();
     * 
*/ public Builder() { if (!(this instanceof UserPath.Builder)) { throw new UnsupportedOperationException("Use: new UserPath.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 UserPath.Builder from(Element instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (UserPath.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.userpath.assertion.AssertionsElement} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder from(AssertionsElement instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (UserPath.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.userpath.UserPath} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder from(UserPath instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (UserPath.Builder) this; } private void from(Object object) { @Var long bits = 0; if (object instanceof Element) { Element instance = (Element) object; if ((bits & 0x1L) == 0) { String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } bits |= 0x1L; } if ((bits & 0x2L) == 0) { Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } bits |= 0x2L; } } if (object instanceof AssertionsElement) { AssertionsElement instance = (AssertionsElement) object; if ((bits & 0x4L) == 0) { addAllAssertions(instance.getAssertions()); bits |= 0x4L; } } if (object instanceof UserPath) { UserPath instance = (UserPath) object; Optional initOptional = instance.getInit(); if (initOptional.isPresent()) { init(initOptional); } if ((bits & 0x1L) == 0) { String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } bits |= 0x1L; } if ((bits & 0x2L) == 0) { Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } bits |= 0x2L; } userSession(instance.getUserSession()); Optional endOptional = instance.getEnd(); if (endOptional.isPresent()) { end(endOptional); } if ((bits & 0x4L) == 0) { addAllAssertions(instance.getAssertions()); bits |= 0x4L; } Container actionsValue = instance.getActions(); if (actionsValue != null) { actions(actionsValue); } } } /** * Initializes the value for the {@link UserPath#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 UserPath.Builder name(String name) { this.name = name; return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder description(String description) { this.description = Objects.requireNonNull(description, "description"); return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#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 UserPath.Builder description(Optional description) { this.description = description.orElse(null); return (UserPath.Builder) this; } /** * Adds one element to {@link UserPath#getAssertions() assertions} list. * @param element A assertions element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder addAssertions(@Nullable Assertion element) { this.assertions.add(element); return (UserPath.Builder) this; } /** * Adds elements to {@link UserPath#getAssertions() assertions} list. * @param elements An array of assertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder addAssertions(Assertion... elements) { this.assertions.add(elements); return (UserPath.Builder) this; } /** * Sets or replaces all elements for {@link UserPath#getAssertions() assertions} list. * @param elements An iterable of assertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("assertions") @JsonDeserialize(using = AssertionsDeserializer.class) @JsonSerialize(using = AssertionsSerializer.class) public final UserPath.Builder assertions(Iterable elements) { this.assertions = ImmutableList.builder(); return addAllAssertions(elements); } /** * Adds elements to {@link UserPath#getAssertions() assertions} list. * @param elements An iterable of assertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder addAllAssertions(Iterable elements) { this.assertions.addAll(elements); return (UserPath.Builder) this; } /** * Initializes the value for the {@link UserPath#getUserSession() userSession} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link UserPath#getUserSession() userSession}. * @param userSession The value for userSession * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("userSession") @JsonInclude(JsonInclude.Include.NON_DEFAULT) public final UserPath.Builder userSession(UserPath.UserSession userSession) { this.userSession = userSession; optBits |= OPT_BIT_USER_SESSION; return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#getInit() init} to init. * @param init The value for init * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder init(Container init) { this.init = Objects.requireNonNull(init, "init"); return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#getInit() init} to init. * @param init The value for init * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("init") public final UserPath.Builder init(Optional init) { this.init = init.orElse(null); return (UserPath.Builder) this; } /** * Initializes the value for the {@link UserPath#getActions() actions} attribute. * @param actions The value for actions (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("actions") public final UserPath.Builder actions(Container actions) { this.actions = actions; return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#getEnd() end} to end. * @param end The value for end * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final UserPath.Builder end(Container end) { this.end = Objects.requireNonNull(end, "end"); return (UserPath.Builder) this; } /** * Initializes the optional value {@link UserPath#getEnd() end} to end. * @param end The value for end * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("end") public final UserPath.Builder end(Optional end) { this.end = end.orElse(null); return (UserPath.Builder) this; } /** * Builds a new {@link ImmutableUserPath ImmutableUserPath}. * @return An immutable instance of UserPath * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableUserPath build() { return new ImmutableUserPath(this); } private boolean userSessionIsSet() { return (optBits & OPT_BIT_USER_SESSION) != 0; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy